@genai-fi/nanogpt 0.10.2 → 0.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Generator.js +11761 -171
- package/dist/{RealDiv-zz7FpkKX.js → RealDiv-KAPDe8zB.js} +23 -25
- package/dist/Reshape-BYkmUnAv.js +14 -0
- package/dist/{Reshape-CHdUjC72.js → Reshape-Zt6eb7yh.js} +18 -20
- package/dist/TeachableLLM.js +10 -11
- package/dist/{axis_util-BsIr9ZNu.js → axis_util-BaG7mf5A.js} +3 -3
- package/dist/backend.js +2 -2
- package/dist/{backend_util-B1XRLuq9.js → backend_util-RCe-rHaj.js} +72 -73
- package/dist/{backend_webgpu-CqpfEImu.js → backend_webgpu-DE3ACOLx.js} +45 -47
- package/dist/broadcast_to-B3eYlZm7.js +28 -0
- package/dist/checks/appendCache.js +2 -2
- package/dist/checks/attentionMask.js +3 -3
- package/dist/checks/gelu.js +2 -2
- package/dist/checks/matMulGelu.js +7 -11
- package/dist/checks/normRMS.js +9 -9
- package/dist/checks/normRMSGrad.js +3 -3
- package/dist/checks/packUnpack.js +2 -2
- package/dist/checks/qkv.js +12 -13
- package/dist/checks/rope.js +2 -2
- package/dist/clip_by_value-BnO7-a88.js +12 -0
- package/dist/complex-DjxcVmoX.js +11 -0
- package/dist/concat-BV8bt5H-.js +17 -0
- package/dist/{concat_util-iBYIyuQe.js → concat_util-DpW8mL_l.js} +1 -1
- package/dist/{dataset-D2P7rHAw.js → dataset-BcwmTGYc.js} +137 -139
- package/dist/dropout-BcvN9JYi.js +92 -0
- package/dist/expand_dims-DT4tEPwA.js +11 -0
- package/dist/{exports_initializers-CZSUJoVE.js → exports_initializers-Hta_rEnm.js} +1 -1
- package/dist/floor-D5QdR_le.js +9 -0
- package/dist/gather-D3JcZUaI.js +9 -0
- package/dist/{gelu-Bmhopi0J.js → gelu-CjNPL4OH.js} +10 -11
- package/dist/{gpgpu_math-DsCcikas.js → gpgpu_math-DAOmgtXR.js} +841 -1015
- package/dist/{index-DRyE072i.js → index-BwexR4lA.js} +262 -263
- package/dist/index-DOvlwCh-.js +3520 -0
- package/dist/{kernel_funcs_utils-CWfOAPGO.js → kernel_funcs_utils-CCzYdUZg.js} +130 -132
- package/dist/layers/BaseLayer.js +15 -16
- package/dist/layers/CausalSelfAttention.js +6 -6
- package/dist/layers/MLP.js +4 -4
- package/dist/layers/PositionEmbedding.js +7 -7
- package/dist/layers/RMSNorm.js +3 -3
- package/dist/layers/RoPECache.js +9 -9
- package/dist/layers/TiedEmbedding.js +6 -6
- package/dist/layers/TransformerBlock.js +1 -1
- package/dist/loader/loadTransformers.js +1 -1
- package/dist/loader/oldZipLoad.js +13 -14
- package/dist/log_sum_exp-ngO0-4pK.js +39 -0
- package/dist/main.js +49 -50
- package/dist/{matMul16-fEAJ4smh.js → matMul16-BWRSOCWB.js} +14 -15
- package/dist/matMulGelu-CzfgT6Wq.js +163 -0
- package/dist/mat_mul-SjpJRLyL.js +11 -0
- package/dist/mod-AnXEvvpo.js +11 -0
- package/dist/models/NanoGPTV1.js +2 -2
- package/dist/models/model.js +13 -14
- package/dist/ones-D2rT0xk2.js +14 -0
- package/dist/ops/adamAdjust.js +1 -1
- package/dist/ops/adamMoments.js +1 -1
- package/dist/ops/add16.js +1 -1
- package/dist/ops/appendCache.js +3 -3
- package/dist/ops/attentionMask.js +1 -1
- package/dist/ops/concat16.js +2 -2
- package/dist/ops/cpu/adamAdjust.js +13 -14
- package/dist/ops/cpu/adamMoments.js +6 -7
- package/dist/ops/cpu/appendCache.js +7 -8
- package/dist/ops/cpu/attentionMask.js +7 -7
- package/dist/ops/cpu/fusedSoftmax.js +10 -11
- package/dist/ops/cpu/gatherSub.js +9 -10
- package/dist/ops/cpu/gelu.js +9 -10
- package/dist/ops/cpu/matMul16.js +6 -7
- package/dist/ops/cpu/matMulGelu.js +5 -6
- package/dist/ops/cpu/matMulMul.js +3 -4
- package/dist/ops/cpu/mulDropout.js +3 -4
- package/dist/ops/cpu/normRMS.js +10 -11
- package/dist/ops/cpu/qkv.js +8 -9
- package/dist/ops/cpu/rope.js +5 -6
- package/dist/ops/cpu/scatterSub.js +17 -19
- package/dist/ops/dot16.js +2 -2
- package/dist/ops/gatherSub.js +1 -1
- package/dist/ops/gelu.js +2 -2
- package/dist/ops/grads/add16.js +11 -12
- package/dist/ops/grads/attentionMask.js +5 -6
- package/dist/ops/grads/gelu.js +3 -4
- package/dist/ops/grads/matMul16.js +4 -5
- package/dist/ops/grads/matMulGelu.js +9 -10
- package/dist/ops/grads/normRMS.js +7 -8
- package/dist/ops/grads/pack16.js +4 -5
- package/dist/ops/grads/qkv.js +17 -19
- package/dist/ops/grads/rope.js +3 -5
- package/dist/ops/grads/softmax16.js +3 -4
- package/dist/ops/grads/unpack16.js +3 -4
- package/dist/ops/grads/utils.d.ts +1 -0
- package/dist/ops/grads/utils.js +8 -4
- package/dist/ops/matMul16.js +3 -3
- package/dist/ops/matMulGelu.js +2 -2
- package/dist/ops/matMulMul.js +1 -1
- package/dist/ops/mul16.js +1 -1
- package/dist/ops/mulDrop.js +1 -1
- package/dist/ops/normRMS.js +1 -1
- package/dist/ops/pack16.js +3 -4
- package/dist/ops/qkv.js +4 -8
- package/dist/ops/reshape16.js +14 -16
- package/dist/ops/rope.d.ts +1 -1
- package/dist/ops/rope.js +3 -8
- package/dist/ops/scatterSub.js +1 -1
- package/dist/ops/slice16.js +2 -2
- package/dist/ops/softmax16.js +5 -8
- package/dist/ops/sub16.js +1 -1
- package/dist/ops/sum16.js +2 -2
- package/dist/ops/transpose16.js +23 -24
- package/dist/ops/unpack16.js +2 -2
- package/dist/ops/webgl/adamAdjust.js +2 -3
- package/dist/ops/webgl/adamMoments.js +1 -2
- package/dist/ops/webgl/appendCache.js +1 -2
- package/dist/ops/webgl/attentionMask.js +4 -5
- package/dist/ops/webgl/fusedSoftmax.js +4 -6
- package/dist/ops/webgl/gatherSub.js +6 -7
- package/dist/ops/webgl/gelu.js +2 -3
- package/dist/ops/webgl/log.js +11 -12
- package/dist/ops/webgl/matMul16.js +10 -11
- package/dist/ops/webgl/matMulGelu.js +7 -111
- package/dist/ops/webgl/matMulMul.js +9 -10
- package/dist/ops/webgl/mulDropout.js +8 -9
- package/dist/ops/webgl/normRMS.js +2 -3
- package/dist/ops/webgl/qkv.js +5 -6
- package/dist/ops/webgl/rope.js +7 -8
- package/dist/ops/webgl/scatterSub.js +5 -6
- package/dist/ops/webgpu/adamAdjust.js +10 -12
- package/dist/ops/webgpu/adamMoments.js +8 -10
- package/dist/ops/webgpu/add16.js +8 -9
- package/dist/ops/webgpu/appendCache.js +23 -25
- package/dist/ops/webgpu/attentionMask.js +8 -10
- package/dist/ops/webgpu/attentionMask32_program.js +2 -2
- package/dist/ops/webgpu/concat16.js +12 -14
- package/dist/ops/webgpu/gatherSub.js +11 -13
- package/dist/ops/webgpu/gelu.js +28 -29
- package/dist/ops/webgpu/matMul16.js +26 -28
- package/dist/ops/webgpu/matMul16_program.js +4 -5
- package/dist/ops/webgpu/mul16.js +9 -10
- package/dist/ops/webgpu/normRMS.js +15 -17
- package/dist/ops/webgpu/normRMSGrad.js +21 -28
- package/dist/ops/webgpu/pack16.js +12 -13
- package/dist/ops/webgpu/pack16_program.js +2 -2
- package/dist/ops/webgpu/qkv.js +16 -18
- package/dist/ops/webgpu/rope.js +25 -27
- package/dist/ops/webgpu/scatterSub.js +7 -9
- package/dist/ops/webgpu/slice16.js +21 -23
- package/dist/ops/webgpu/softmax16.js +17 -19
- package/dist/ops/webgpu/softmax16_program.js +2 -2
- package/dist/ops/webgpu/softmax16_subgroup_program.js +2 -2
- package/dist/ops/webgpu/softmax16grad.js +7 -8
- package/dist/ops/webgpu/sub16.js +7 -8
- package/dist/ops/webgpu/sum16.js +18 -20
- package/dist/ops/webgpu/transpose16.js +19 -20
- package/dist/ops/webgpu/transpose16_program.js +2 -2
- package/dist/ops/webgpu/transpose16_shared_program.js +11 -12
- package/dist/ops/webgpu/unpack16.js +3 -4
- package/dist/ops/webgpu/utils/binary_op.js +7 -8
- package/dist/ops/webgpu/utils/reductions.js +14 -22
- package/dist/ops-B5yanEdW.js +476 -0
- package/dist/pack16-nQ6JaLo-.js +39 -0
- package/dist/patches/webgpu_backend.js +19 -20
- package/dist/patches/webgpu_base.js +1 -1
- package/dist/patches/webgpu_program.js +21 -22
- package/dist/{random_width-BVV9HveY.js → random_width-or-CEftb.js} +2506 -2761
- package/dist/range-BklejeeW.js +10 -0
- package/dist/relu-CP0ZcxWO.js +9 -0
- package/dist/reshape-ByE68wS9.js +9 -0
- package/dist/resize_nearest_neighbor-B19mCEg2.js +175 -0
- package/dist/rope-Ir4mTyD1.js +24 -0
- package/dist/{scatter_nd_util-C7zXRT_h.js → scatter_nd_util-lvSiX8q4.js} +1 -1
- package/dist/selu_util-kbhpTdYD.js +44 -0
- package/dist/{shared-CHhxz-O5.js → shared-DT1TkE6w.js} +1 -1
- package/dist/{shared-D2NP_CpY.js → shared-dntlHIDQ.js} +343 -345
- package/dist/slice-BfEGSH82.js +12 -0
- package/dist/{slice_util-DyjSAD0u.js → slice_util-uTKwiEpW.js} +1 -1
- package/dist/{softmax-C9JQEtnO.js → softmax-CA5jFsLR.js} +4 -5
- package/dist/split-CVLc0w--.js +9 -0
- package/dist/squeeze-C7Z2srUo.js +10 -0
- package/dist/stack-Cf4n9h0N.js +11 -0
- package/dist/step-CINUs5QB.js +261 -0
- package/dist/sum-DWAtNGez.js +11 -0
- package/dist/tensor-DJoc7gJU.js +8 -0
- package/dist/tensor1d-D11P_7Dp.js +11 -0
- package/dist/{tensor2d-CSB4KOb0.js → tensor2d-Bs9wZRc7.js} +6 -7
- package/dist/{tensor4d-D7bLqGqz.js → tensor4d-BARPdTaS.js} +6 -7
- package/dist/{tfjs_backend-CNkSTL0c.js → tfjs_backend-y1cvNhLA.js} +255 -264
- package/dist/tile-mbfagpsB.js +11 -0
- package/dist/training/Adam.js +2 -2
- package/dist/training/AdamExt.js +1 -1
- package/dist/training/DatasetBuilder.js +2 -2
- package/dist/training/FullTrainer.js +1 -1
- package/dist/training/Trainer.js +2 -2
- package/dist/training/sparseCrossEntropy.js +5 -5
- package/dist/transpose-ClWiBS_b.js +36 -0
- package/dist/unsorted_segment_sum-BDDhB_E6.js +277 -0
- package/dist/utilities/dummy.js +3 -3
- package/dist/utilities/multinomialCPU.js +2 -2
- package/dist/utilities/packed.d.ts +1 -4
- package/dist/utilities/packed.js +10 -745
- package/dist/utilities/performance.js +1 -1
- package/dist/utilities/profile.js +1 -1
- package/dist/utilities/safetensors.js +2 -2
- package/dist/utilities/sentences.js +5 -5
- package/dist/utilities/weights.js +2 -2
- package/dist/{variable-DzfrwYuP.js → variable-WawDEaAb.js} +1 -1
- package/dist/{webgpu_program-DzaQiqel.js → webgpu_program-DuOXPQol.js} +178 -172
- package/dist/{webgpu_util-0_ubCEHJ.js → webgpu_util-RxEF33Rj.js} +34 -35
- package/dist/zeros-KnWaWf-X.js +13 -0
- package/dist/zeros_like-DvE73F4e.js +721 -0
- package/package.json +4 -2
- package/dist/Reshape-CDVLyVfz.js +0 -16
- package/dist/broadcast_to-B0ChcDaz.js +0 -30
- package/dist/complex-BBiRlsVq.js +0 -13
- package/dist/concat-DmBLPVGC.js +0 -19
- package/dist/dropout-B1x1kYMa.js +0 -99
- package/dist/expand_dims-ouvfxQ1n.js +0 -13
- package/dist/gather-CH9sdacz.js +0 -10
- package/dist/index-D6Q1lPZO.js +0 -2157
- package/dist/log_sum_exp-D3ftBNY5.js +0 -41
- package/dist/mat_mul-C59XWcJd.js +0 -12
- package/dist/mod-DESSvHIU.js +0 -12
- package/dist/mulmat_packed_gpu-Coh6qbJk.js +0 -55
- package/dist/ones-jU9jlQvM.js +0 -15
- package/dist/ops-BFDtP6th.js +0 -645
- package/dist/pack16-CmVZs6af.js +0 -41
- package/dist/patches/PackedTensor.d.ts +0 -12
- package/dist/patches/PackedTensor.js +0 -11
- package/dist/patches/engine.d.ts +0 -261
- package/dist/patches/engine.js +0 -12
- package/dist/patches/tape.d.ts +0 -12
- package/dist/patches/tape.js +0 -5
- package/dist/range-ZZZD60Fx.js +0 -11
- package/dist/reciprocal-CrYlsAGD.js +0 -10
- package/dist/register_all_kernels-nvj2k7OC.js +0 -12307
- package/dist/relu-BYDneVPn.js +0 -10
- package/dist/reshape-CaPQzFvz.js +0 -10
- package/dist/rope-s4W2XO9B.js +0 -32
- package/dist/selu_util-BGPXmd4B.js +0 -303
- package/dist/sin-Djs4aQiu.js +0 -16
- package/dist/slice-DvovR5wq.js +0 -13
- package/dist/split-DBck65sX.js +0 -10
- package/dist/squeeze-C00Ipm_7.js +0 -11
- package/dist/stack-ChnHwRpX.js +0 -13
- package/dist/sum-ywRJj3Zr.js +0 -12
- package/dist/tensor-0r5yOo2R.js +0 -8
- package/dist/tensor-CzmOBsdf.js +0 -909
- package/dist/tensor1d-BlUT89BP.js +0 -12
- package/dist/tensor_util-DfwaWayG.js +0 -523
- package/dist/tile-CR074jmp.js +0 -13
- package/dist/transpose-DH4gmHvu.js +0 -38
- package/dist/zeros-DBFVbpv5.js +0 -14
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
3
|
-
import { a9 as $e, h as ze, I as Be, F as je, x as Ge, A as qt, aF as _t, aG as Vt, aH as Ct, z as Dt, aI as Wt, Q as Ut, a6 as $t, ak as zt, al as Bt, am as jt, an as Gt, L as Zt, af as Ht, ar as Kt, a7 as Xt, N as Ze, as as Jt, H as He, aJ as Ke, u as Xe, aK as Qt, U as Yt, f as Je, ad as te, au as ee, aL as ne, ae as se } from "./tensor_util-DfwaWayG.js";
|
|
4
|
-
import { f as it, g as Qe, a as Ye, R as tn, v as en, d as nn, e as sn, h as on, i as rn, j as an, k as ln, l as cn, m as un, n as hn, o as fn, p as kt, q as dn, r as gn, s as mn } from "./backend_util-B1XRLuq9.js";
|
|
1
|
+
import { l as Lt, bR as Ce, h as V, a3 as Pt, ad as K, i as et, o as ht, bS as dt, bT as at, ac as De, Z as st, aQ as We, ar as Ue, bU as $e, bV as ze, bW as Be, bX as qt, at as H, bY as At, bZ as W, b_ as _t, bC as Vt, an as Ct, b$ as Dt, J as Wt, c0 as Ut, b1 as $t, b2 as zt, b3 as Bt, b4 as jt, ao as Gt, c1 as Zt, b8 as Ht, c2 as Kt, aq as je, aR as Ge, b9 as Xt, as as Ze, c3 as He, af as Jt, ak as Ke, t as Xe, bM as Qt, c4 as It, aH as Yt, S as Je, c5 as te, bb as ee, c6 as ne, aB as pt, c7 as se, c8 as ot } from "./index-DOvlwCh-.js";
|
|
2
|
+
import { f as it, g as Qe, a as Ye, R as tn, v as en, d as nn, e as sn, h as on, i as rn, j as an, k as ln, l as cn, m as un, n as hn, o as fn, p as kt, q as dn, r as gn, s as mn } from "./backend_util-RCe-rHaj.js";
|
|
5
3
|
import { m as Nt } from "./complex_util-Yc1A_gV1.js";
|
|
6
|
-
import { a as pn, b as wn, e as In, c as
|
|
7
|
-
import { b as
|
|
8
|
-
import { r as
|
|
9
|
-
import { p as
|
|
4
|
+
import { a as pn, b as wn, e as In, c as bn } from "./axis_util-BaG7mf5A.js";
|
|
5
|
+
import { b as xn } from "./broadcast_to-B3eYlZm7.js";
|
|
6
|
+
import { r as En } from "./reshape-ByE68wS9.js";
|
|
7
|
+
import { p as Fn, a as yn, i as kn, c as Nn } from "./slice_util-uTKwiEpW.js";
|
|
10
8
|
import { g as vn } from "./_commonjsHelpers-ByX85dGu.js";
|
|
11
9
|
function Sn(e, t) {
|
|
12
10
|
for (var n = 0; n < t.length; n++) {
|
|
@@ -320,8 +318,8 @@ function Tn() {
|
|
|
320
318
|
])), {}).exports;
|
|
321
319
|
} catch {
|
|
322
320
|
}
|
|
323
|
-
function t(I, c,
|
|
324
|
-
this.low = I | 0, this.high = c | 0, this.unsigned = !!
|
|
321
|
+
function t(I, c, E) {
|
|
322
|
+
this.low = I | 0, this.high = c | 0, this.unsigned = !!E;
|
|
325
323
|
}
|
|
326
324
|
t.prototype.__isLong__, Object.defineProperty(t.prototype, "__isLong__", { value: !0 });
|
|
327
325
|
function n(I) {
|
|
@@ -330,48 +328,48 @@ function Tn() {
|
|
|
330
328
|
t.isLong = n;
|
|
331
329
|
var s = {}, o = {};
|
|
332
330
|
function a(I, c) {
|
|
333
|
-
var
|
|
334
|
-
return c ? (I >>>= 0, (L = 0 <= I && I < 256) && (N = o[I], N) ? N : (
|
|
331
|
+
var E, N, L;
|
|
332
|
+
return c ? (I >>>= 0, (L = 0 <= I && I < 256) && (N = o[I], N) ? N : (E = i(I, (I | 0) < 0 ? -1 : 0, !0), L && (o[I] = E), E)) : (I |= 0, (L = -128 <= I && I < 128) && (N = s[I], N) ? N : (E = i(I, I < 0 ? -1 : 0, !1), L && (s[I] = E), E));
|
|
335
333
|
}
|
|
336
334
|
t.fromInt = a;
|
|
337
335
|
function r(I, c) {
|
|
338
336
|
if (isNaN(I))
|
|
339
|
-
return c ?
|
|
337
|
+
return c ? b : g;
|
|
340
338
|
if (c) {
|
|
341
339
|
if (I < 0)
|
|
342
|
-
return
|
|
340
|
+
return b;
|
|
343
341
|
if (I >= m)
|
|
344
342
|
return O;
|
|
345
343
|
} else {
|
|
346
|
-
if (I <= -
|
|
344
|
+
if (I <= -F)
|
|
347
345
|
return S;
|
|
348
|
-
if (I + 1 >=
|
|
346
|
+
if (I + 1 >= F)
|
|
349
347
|
return M;
|
|
350
348
|
}
|
|
351
349
|
return I < 0 ? r(-I, c).neg() : i(I % w | 0, I / w | 0, c);
|
|
352
350
|
}
|
|
353
351
|
t.fromNumber = r;
|
|
354
|
-
function i(I, c,
|
|
355
|
-
return new t(I, c,
|
|
352
|
+
function i(I, c, E) {
|
|
353
|
+
return new t(I, c, E);
|
|
356
354
|
}
|
|
357
355
|
t.fromBits = i;
|
|
358
356
|
var l = Math.pow;
|
|
359
|
-
function u(I, c,
|
|
357
|
+
function u(I, c, E) {
|
|
360
358
|
if (I.length === 0)
|
|
361
359
|
throw Error("empty string");
|
|
362
360
|
if (I === "NaN" || I === "Infinity" || I === "+Infinity" || I === "-Infinity")
|
|
363
361
|
return g;
|
|
364
|
-
if (typeof c == "number" ? (
|
|
362
|
+
if (typeof c == "number" ? (E = c, c = !1) : c = !!c, E = E || 10, E < 2 || 36 < E)
|
|
365
363
|
throw RangeError("radix");
|
|
366
364
|
var N;
|
|
367
365
|
if ((N = I.indexOf("-")) > 0)
|
|
368
366
|
throw Error("interior hyphen");
|
|
369
367
|
if (N === 0)
|
|
370
|
-
return u(I.substring(1), c,
|
|
371
|
-
for (var L = r(l(
|
|
372
|
-
var $ = Math.min(8, I.length -
|
|
368
|
+
return u(I.substring(1), c, E).neg();
|
|
369
|
+
for (var L = r(l(E, 8)), R = g, q = 0; q < I.length; q += 8) {
|
|
370
|
+
var $ = Math.min(8, I.length - q), j = parseInt(I.substring(q, q + $), E);
|
|
373
371
|
if ($ < 8) {
|
|
374
|
-
var C = r(l(
|
|
372
|
+
var C = r(l(E, $));
|
|
375
373
|
R = R.mul(C).add(r(j));
|
|
376
374
|
} else
|
|
377
375
|
R = R.mul(L), R = R.add(r(j));
|
|
@@ -383,10 +381,10 @@ function Tn() {
|
|
|
383
381
|
return typeof I == "number" ? r(I, c) : typeof I == "string" ? u(I, c) : i(I.low, I.high, typeof c == "boolean" ? c : I.unsigned);
|
|
384
382
|
}
|
|
385
383
|
t.fromValue = h;
|
|
386
|
-
var f = 65536, p = 1 << 24, w = f * f, m = w * w,
|
|
384
|
+
var f = 65536, p = 1 << 24, w = f * f, m = w * w, F = m / 2, d = a(p), g = a(0);
|
|
387
385
|
t.ZERO = g;
|
|
388
|
-
var
|
|
389
|
-
t.UZERO =
|
|
386
|
+
var b = a(0, !0);
|
|
387
|
+
t.UZERO = b;
|
|
390
388
|
var k = a(1);
|
|
391
389
|
t.ONE = k;
|
|
392
390
|
var y = a(1, !0);
|
|
@@ -399,105 +397,105 @@ function Tn() {
|
|
|
399
397
|
t.MAX_UNSIGNED_VALUE = O;
|
|
400
398
|
var S = i(0, -2147483648, !1);
|
|
401
399
|
t.MIN_VALUE = S;
|
|
402
|
-
var
|
|
403
|
-
return
|
|
400
|
+
var x = t.prototype;
|
|
401
|
+
return x.toInt = function() {
|
|
404
402
|
return this.unsigned ? this.low >>> 0 : this.low;
|
|
405
|
-
},
|
|
403
|
+
}, x.toNumber = function() {
|
|
406
404
|
return this.unsigned ? (this.high >>> 0) * w + (this.low >>> 0) : this.high * w + (this.low >>> 0);
|
|
407
|
-
},
|
|
405
|
+
}, x.toString = function(c) {
|
|
408
406
|
if (c = c || 10, c < 2 || 36 < c)
|
|
409
407
|
throw RangeError("radix");
|
|
410
408
|
if (this.isZero())
|
|
411
409
|
return "0";
|
|
412
410
|
if (this.isNegative())
|
|
413
411
|
if (this.eq(S)) {
|
|
414
|
-
var
|
|
412
|
+
var E = r(c), N = this.div(E), L = N.mul(E).sub(this);
|
|
415
413
|
return N.toString(c) + L.toInt().toString(c);
|
|
416
414
|
} else
|
|
417
415
|
return "-" + this.neg().toString(c);
|
|
418
|
-
for (var R = r(l(c, 6), this.unsigned),
|
|
419
|
-
var j =
|
|
420
|
-
if (
|
|
416
|
+
for (var R = r(l(c, 6), this.unsigned), q = this, $ = ""; ; ) {
|
|
417
|
+
var j = q.div(R), C = q.sub(j.mul(R)).toInt() >>> 0, P = C.toString(c);
|
|
418
|
+
if (q = j, q.isZero())
|
|
421
419
|
return P + $;
|
|
422
420
|
for (; P.length < 6; )
|
|
423
421
|
P = "0" + P;
|
|
424
422
|
$ = "" + P + $;
|
|
425
423
|
}
|
|
426
|
-
},
|
|
424
|
+
}, x.getHighBits = function() {
|
|
427
425
|
return this.high;
|
|
428
|
-
},
|
|
426
|
+
}, x.getHighBitsUnsigned = function() {
|
|
429
427
|
return this.high >>> 0;
|
|
430
|
-
},
|
|
428
|
+
}, x.getLowBits = function() {
|
|
431
429
|
return this.low;
|
|
432
|
-
},
|
|
430
|
+
}, x.getLowBitsUnsigned = function() {
|
|
433
431
|
return this.low >>> 0;
|
|
434
|
-
},
|
|
432
|
+
}, x.getNumBitsAbs = function() {
|
|
435
433
|
if (this.isNegative())
|
|
436
434
|
return this.eq(S) ? 64 : this.neg().getNumBitsAbs();
|
|
437
|
-
for (var c = this.high != 0 ? this.high : this.low,
|
|
435
|
+
for (var c = this.high != 0 ? this.high : this.low, E = 31; E > 0 && (c & 1 << E) == 0; E--)
|
|
438
436
|
;
|
|
439
|
-
return this.high != 0 ?
|
|
440
|
-
},
|
|
437
|
+
return this.high != 0 ? E + 33 : E + 1;
|
|
438
|
+
}, x.isZero = function() {
|
|
441
439
|
return this.high === 0 && this.low === 0;
|
|
442
|
-
},
|
|
440
|
+
}, x.eqz = x.isZero, x.isNegative = function() {
|
|
443
441
|
return !this.unsigned && this.high < 0;
|
|
444
|
-
},
|
|
442
|
+
}, x.isPositive = function() {
|
|
445
443
|
return this.unsigned || this.high >= 0;
|
|
446
|
-
},
|
|
444
|
+
}, x.isOdd = function() {
|
|
447
445
|
return (this.low & 1) === 1;
|
|
448
|
-
},
|
|
446
|
+
}, x.isEven = function() {
|
|
449
447
|
return (this.low & 1) === 0;
|
|
450
|
-
},
|
|
448
|
+
}, x.equals = function(c) {
|
|
451
449
|
return n(c) || (c = h(c)), this.unsigned !== c.unsigned && this.high >>> 31 === 1 && c.high >>> 31 === 1 ? !1 : this.high === c.high && this.low === c.low;
|
|
452
|
-
},
|
|
450
|
+
}, x.eq = x.equals, x.notEquals = function(c) {
|
|
453
451
|
return !this.eq(
|
|
454
452
|
/* validates */
|
|
455
453
|
c
|
|
456
454
|
);
|
|
457
|
-
},
|
|
455
|
+
}, x.neq = x.notEquals, x.ne = x.notEquals, x.lessThan = function(c) {
|
|
458
456
|
return this.comp(
|
|
459
457
|
/* validates */
|
|
460
458
|
c
|
|
461
459
|
) < 0;
|
|
462
|
-
},
|
|
460
|
+
}, x.lt = x.lessThan, x.lessThanOrEqual = function(c) {
|
|
463
461
|
return this.comp(
|
|
464
462
|
/* validates */
|
|
465
463
|
c
|
|
466
464
|
) <= 0;
|
|
467
|
-
},
|
|
465
|
+
}, x.lte = x.lessThanOrEqual, x.le = x.lessThanOrEqual, x.greaterThan = function(c) {
|
|
468
466
|
return this.comp(
|
|
469
467
|
/* validates */
|
|
470
468
|
c
|
|
471
469
|
) > 0;
|
|
472
|
-
},
|
|
470
|
+
}, x.gt = x.greaterThan, x.greaterThanOrEqual = function(c) {
|
|
473
471
|
return this.comp(
|
|
474
472
|
/* validates */
|
|
475
473
|
c
|
|
476
474
|
) >= 0;
|
|
477
|
-
},
|
|
475
|
+
}, x.gte = x.greaterThanOrEqual, x.ge = x.greaterThanOrEqual, x.compare = function(c) {
|
|
478
476
|
if (n(c) || (c = h(c)), this.eq(c))
|
|
479
477
|
return 0;
|
|
480
|
-
var
|
|
481
|
-
return
|
|
482
|
-
},
|
|
478
|
+
var E = this.isNegative(), N = c.isNegative();
|
|
479
|
+
return E && !N ? -1 : !E && N ? 1 : this.unsigned ? c.high >>> 0 > this.high >>> 0 || c.high === this.high && c.low >>> 0 > this.low >>> 0 ? -1 : 1 : this.sub(c).isNegative() ? -1 : 1;
|
|
480
|
+
}, x.comp = x.compare, x.negate = function() {
|
|
483
481
|
return !this.unsigned && this.eq(S) ? S : this.not().add(k);
|
|
484
|
-
},
|
|
482
|
+
}, x.neg = x.negate, x.add = function(c) {
|
|
485
483
|
n(c) || (c = h(c));
|
|
486
|
-
var
|
|
487
|
-
return B += R + C, _ += B >>> 16, B &= 65535, _ += L + j, G += _ >>> 16, _ &= 65535, G += N + $, P += G >>> 16, G &= 65535, P +=
|
|
488
|
-
},
|
|
484
|
+
var E = this.high >>> 16, N = this.high & 65535, L = this.low >>> 16, R = this.low & 65535, q = c.high >>> 16, $ = c.high & 65535, j = c.low >>> 16, C = c.low & 65535, P = 0, G = 0, _ = 0, B = 0;
|
|
485
|
+
return B += R + C, _ += B >>> 16, B &= 65535, _ += L + j, G += _ >>> 16, _ &= 65535, G += N + $, P += G >>> 16, G &= 65535, P += E + q, P &= 65535, i(_ << 16 | B, P << 16 | G, this.unsigned);
|
|
486
|
+
}, x.subtract = function(c) {
|
|
489
487
|
return n(c) || (c = h(c)), this.add(c.neg());
|
|
490
|
-
},
|
|
488
|
+
}, x.sub = x.subtract, x.multiply = function(c) {
|
|
491
489
|
if (this.isZero())
|
|
492
490
|
return g;
|
|
493
491
|
if (n(c) || (c = h(c)), e) {
|
|
494
|
-
var
|
|
492
|
+
var E = e.mul(
|
|
495
493
|
this.low,
|
|
496
494
|
this.high,
|
|
497
495
|
c.low,
|
|
498
496
|
c.high
|
|
499
497
|
);
|
|
500
|
-
return i(
|
|
498
|
+
return i(E, e.get_high(), this.unsigned);
|
|
501
499
|
}
|
|
502
500
|
if (c.isZero())
|
|
503
501
|
return g;
|
|
@@ -511,41 +509,41 @@ function Tn() {
|
|
|
511
509
|
return this.mul(c.neg()).neg();
|
|
512
510
|
if (this.lt(d) && c.lt(d))
|
|
513
511
|
return r(this.toNumber() * c.toNumber(), this.unsigned);
|
|
514
|
-
var N = this.high >>> 16, L = this.high & 65535, R = this.low >>> 16,
|
|
515
|
-
return ct +=
|
|
516
|
-
},
|
|
512
|
+
var N = this.high >>> 16, L = this.high & 65535, R = this.low >>> 16, q = this.low & 65535, $ = c.high >>> 16, j = c.high & 65535, C = c.low >>> 16, P = c.low & 65535, G = 0, _ = 0, B = 0, ct = 0;
|
|
513
|
+
return ct += q * P, B += ct >>> 16, ct &= 65535, B += R * P, _ += B >>> 16, B &= 65535, B += q * C, _ += B >>> 16, B &= 65535, _ += L * P, G += _ >>> 16, _ &= 65535, _ += R * C, G += _ >>> 16, _ &= 65535, _ += q * j, G += _ >>> 16, _ &= 65535, G += N * P + L * C + R * j + q * $, G &= 65535, i(B << 16 | ct, G << 16 | _, this.unsigned);
|
|
514
|
+
}, x.mul = x.multiply, x.divide = function(c) {
|
|
517
515
|
if (n(c) || (c = h(c)), c.isZero())
|
|
518
516
|
throw Error("division by zero");
|
|
519
517
|
if (e) {
|
|
520
518
|
if (!this.unsigned && this.high === -2147483648 && c.low === -1 && c.high === -1)
|
|
521
519
|
return this;
|
|
522
|
-
var
|
|
520
|
+
var E = (this.unsigned ? e.div_u : e.div_s)(
|
|
523
521
|
this.low,
|
|
524
522
|
this.high,
|
|
525
523
|
c.low,
|
|
526
524
|
c.high
|
|
527
525
|
);
|
|
528
|
-
return i(
|
|
526
|
+
return i(E, e.get_high(), this.unsigned);
|
|
529
527
|
}
|
|
530
528
|
if (this.isZero())
|
|
531
|
-
return this.unsigned ?
|
|
529
|
+
return this.unsigned ? b : g;
|
|
532
530
|
var N, L, R;
|
|
533
531
|
if (this.unsigned) {
|
|
534
532
|
if (c.unsigned || (c = c.toUnsigned()), c.gt(this))
|
|
535
|
-
return
|
|
533
|
+
return b;
|
|
536
534
|
if (c.gt(this.shru(1)))
|
|
537
535
|
return y;
|
|
538
|
-
R =
|
|
536
|
+
R = b;
|
|
539
537
|
} else {
|
|
540
538
|
if (this.eq(S)) {
|
|
541
539
|
if (c.eq(k) || c.eq(v))
|
|
542
540
|
return S;
|
|
543
541
|
if (c.eq(S))
|
|
544
542
|
return k;
|
|
545
|
-
var
|
|
546
|
-
return N =
|
|
543
|
+
var q = this.shr(1);
|
|
544
|
+
return N = q.div(c).shl(1), N.eq(g) ? c.isNegative() ? k : v : (L = this.sub(c.mul(N)), R = N.add(L.div(c)), R);
|
|
547
545
|
} else if (c.eq(S))
|
|
548
|
-
return this.unsigned ?
|
|
546
|
+
return this.unsigned ? b : g;
|
|
549
547
|
if (this.isNegative())
|
|
550
548
|
return c.isNegative() ? this.neg().div(c.neg()) : this.neg().div(c).neg();
|
|
551
549
|
if (c.isNegative())
|
|
@@ -559,80 +557,80 @@ function Tn() {
|
|
|
559
557
|
C.isZero() && (C = k), R = R.add(C), L = L.sub(P);
|
|
560
558
|
}
|
|
561
559
|
return R;
|
|
562
|
-
},
|
|
560
|
+
}, x.div = x.divide, x.modulo = function(c) {
|
|
563
561
|
if (n(c) || (c = h(c)), e) {
|
|
564
|
-
var
|
|
562
|
+
var E = (this.unsigned ? e.rem_u : e.rem_s)(
|
|
565
563
|
this.low,
|
|
566
564
|
this.high,
|
|
567
565
|
c.low,
|
|
568
566
|
c.high
|
|
569
567
|
);
|
|
570
|
-
return i(
|
|
568
|
+
return i(E, e.get_high(), this.unsigned);
|
|
571
569
|
}
|
|
572
570
|
return this.sub(this.div(c).mul(c));
|
|
573
|
-
},
|
|
571
|
+
}, x.mod = x.modulo, x.rem = x.modulo, x.not = function() {
|
|
574
572
|
return i(~this.low, ~this.high, this.unsigned);
|
|
575
|
-
},
|
|
573
|
+
}, x.and = function(c) {
|
|
576
574
|
return n(c) || (c = h(c)), i(this.low & c.low, this.high & c.high, this.unsigned);
|
|
577
|
-
},
|
|
575
|
+
}, x.or = function(c) {
|
|
578
576
|
return n(c) || (c = h(c)), i(this.low | c.low, this.high | c.high, this.unsigned);
|
|
579
|
-
},
|
|
577
|
+
}, x.xor = function(c) {
|
|
580
578
|
return n(c) || (c = h(c)), i(this.low ^ c.low, this.high ^ c.high, this.unsigned);
|
|
581
|
-
},
|
|
579
|
+
}, x.shiftLeft = function(c) {
|
|
582
580
|
return n(c) && (c = c.toInt()), (c &= 63) === 0 ? this : c < 32 ? i(this.low << c, this.high << c | this.low >>> 32 - c, this.unsigned) : i(0, this.low << c - 32, this.unsigned);
|
|
583
|
-
},
|
|
581
|
+
}, x.shl = x.shiftLeft, x.shiftRight = function(c) {
|
|
584
582
|
return n(c) && (c = c.toInt()), (c &= 63) === 0 ? this : c < 32 ? i(this.low >>> c | this.high << 32 - c, this.high >> c, this.unsigned) : i(this.high >> c - 32, this.high >= 0 ? 0 : -1, this.unsigned);
|
|
585
|
-
},
|
|
583
|
+
}, x.shr = x.shiftRight, x.shiftRightUnsigned = function(c) {
|
|
586
584
|
if (n(c) && (c = c.toInt()), c &= 63, c === 0)
|
|
587
585
|
return this;
|
|
588
|
-
var
|
|
586
|
+
var E = this.high;
|
|
589
587
|
if (c < 32) {
|
|
590
588
|
var N = this.low;
|
|
591
|
-
return i(N >>> c |
|
|
592
|
-
} else return c === 32 ? i(
|
|
593
|
-
},
|
|
589
|
+
return i(N >>> c | E << 32 - c, E >>> c, this.unsigned);
|
|
590
|
+
} else return c === 32 ? i(E, 0, this.unsigned) : i(E >>> c - 32, 0, this.unsigned);
|
|
591
|
+
}, x.shru = x.shiftRightUnsigned, x.shr_u = x.shiftRightUnsigned, x.toSigned = function() {
|
|
594
592
|
return this.unsigned ? i(this.low, this.high, !1) : this;
|
|
595
|
-
},
|
|
593
|
+
}, x.toUnsigned = function() {
|
|
596
594
|
return this.unsigned ? this : i(this.low, this.high, !0);
|
|
597
|
-
},
|
|
595
|
+
}, x.toBytes = function(c) {
|
|
598
596
|
return c ? this.toBytesLE() : this.toBytesBE();
|
|
599
|
-
},
|
|
600
|
-
var c = this.high,
|
|
597
|
+
}, x.toBytesLE = function() {
|
|
598
|
+
var c = this.high, E = this.low;
|
|
601
599
|
return [
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
600
|
+
E & 255,
|
|
601
|
+
E >>> 8 & 255,
|
|
602
|
+
E >>> 16 & 255,
|
|
603
|
+
E >>> 24,
|
|
606
604
|
c & 255,
|
|
607
605
|
c >>> 8 & 255,
|
|
608
606
|
c >>> 16 & 255,
|
|
609
607
|
c >>> 24
|
|
610
608
|
];
|
|
611
|
-
},
|
|
612
|
-
var c = this.high,
|
|
609
|
+
}, x.toBytesBE = function() {
|
|
610
|
+
var c = this.high, E = this.low;
|
|
613
611
|
return [
|
|
614
612
|
c >>> 24,
|
|
615
613
|
c >>> 16 & 255,
|
|
616
614
|
c >>> 8 & 255,
|
|
617
615
|
c & 255,
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
616
|
+
E >>> 24,
|
|
617
|
+
E >>> 16 & 255,
|
|
618
|
+
E >>> 8 & 255,
|
|
619
|
+
E & 255
|
|
622
620
|
];
|
|
623
|
-
}, t.fromBytes = function(c,
|
|
624
|
-
return N ? t.fromBytesLE(c,
|
|
625
|
-
}, t.fromBytesLE = function(c,
|
|
621
|
+
}, t.fromBytes = function(c, E, N) {
|
|
622
|
+
return N ? t.fromBytesLE(c, E) : t.fromBytesBE(c, E);
|
|
623
|
+
}, t.fromBytesLE = function(c, E) {
|
|
626
624
|
return new t(
|
|
627
625
|
c[0] | c[1] << 8 | c[2] << 16 | c[3] << 24,
|
|
628
626
|
c[4] | c[5] << 8 | c[6] << 16 | c[7] << 24,
|
|
629
|
-
|
|
627
|
+
E
|
|
630
628
|
);
|
|
631
|
-
}, t.fromBytesBE = function(c,
|
|
629
|
+
}, t.fromBytesBE = function(c, E) {
|
|
632
630
|
return new t(
|
|
633
631
|
c[4] << 24 | c[5] << 16 | c[6] << 8 | c[7],
|
|
634
632
|
c[0] << 24 | c[1] << 16 | c[2] << 8 | c[3],
|
|
635
|
-
|
|
633
|
+
E
|
|
636
634
|
);
|
|
637
635
|
}, wt;
|
|
638
636
|
}
|
|
@@ -649,7 +647,7 @@ function gt(e) {
|
|
|
649
647
|
return tt.fromString(e, !0, 16);
|
|
650
648
|
}
|
|
651
649
|
const ae = gt("c3a5c85c97cb3127"), Y = gt("b492b66fbe98f273"), D = gt("9ae16a3b2f90404f");
|
|
652
|
-
function
|
|
650
|
+
function bt(e) {
|
|
653
651
|
return e.xor(e.shru(47));
|
|
654
652
|
}
|
|
655
653
|
function ie(e, t, n) {
|
|
@@ -662,7 +660,7 @@ function T(e, t) {
|
|
|
662
660
|
function St(e, t) {
|
|
663
661
|
return ie(e, t, 4);
|
|
664
662
|
}
|
|
665
|
-
function
|
|
663
|
+
function A(e, t) {
|
|
666
664
|
return t === 0 ? e : e.shru(t).or(e.shl(64 - t));
|
|
667
665
|
}
|
|
668
666
|
function J(e, t, n = gt("9ddfea08eb382d69")) {
|
|
@@ -672,16 +670,16 @@ function J(e, t, n = gt("9ddfea08eb382d69")) {
|
|
|
672
670
|
return o = o.xor(o.shru(47)), o = o.mul(n), o;
|
|
673
671
|
}
|
|
674
672
|
function Mn(e, t, n, s, o, a) {
|
|
675
|
-
o = o.add(e), a =
|
|
673
|
+
o = o.add(e), a = A(a.add(o).add(s), 21);
|
|
676
674
|
const r = o;
|
|
677
|
-
return o = o.add(t), o = o.add(n), a = a.add(
|
|
675
|
+
return o = o.add(t), o = o.add(n), a = a.add(A(o, 44)), [o.add(s), a.add(r)];
|
|
678
676
|
}
|
|
679
677
|
function ut(e, t, n, s) {
|
|
680
678
|
return Mn(T(e, t), T(e, t + 8), T(e, t + 16), T(e, t + 24), n, s);
|
|
681
679
|
}
|
|
682
680
|
function On(e, t = e.length) {
|
|
683
681
|
if (t >= 8) {
|
|
684
|
-
const n = D.add(t * 2), s = T(e, 0).add(D), o = T(e, t - 8), a =
|
|
682
|
+
const n = D.add(t * 2), s = T(e, 0).add(D), o = T(e, t - 8), a = A(o, 37).mul(n).add(s), r = A(s, 25).add(o).mul(n);
|
|
685
683
|
return J(a, r, n);
|
|
686
684
|
}
|
|
687
685
|
if (t >= 4) {
|
|
@@ -690,37 +688,37 @@ function On(e, t = e.length) {
|
|
|
690
688
|
}
|
|
691
689
|
if (t > 0) {
|
|
692
690
|
const n = e[0], s = e[t >> 1], o = e[t - 1], a = n + (s << 8), r = t + (o << 2);
|
|
693
|
-
return
|
|
691
|
+
return bt(D.mul(a).xor(ae.mul(r))).mul(D);
|
|
694
692
|
}
|
|
695
693
|
return D;
|
|
696
694
|
}
|
|
697
695
|
function Ln(e, t = e.length) {
|
|
698
696
|
const n = D.add(t * 2), s = T(e, 0).mul(Y), o = T(e, 8), a = T(e, t - 8).mul(n), r = T(e, t - 16).mul(D);
|
|
699
|
-
return J(
|
|
697
|
+
return J(A(s.add(o), 43).add(A(a, 30)).add(r), s.add(A(o.add(D), 18)).add(a), n);
|
|
700
698
|
}
|
|
701
699
|
function Pn(e, t = e.length) {
|
|
702
|
-
const n = D.add(t * 2), s = T(e, 0).mul(D), o = T(e, 8), a = T(e, t - 8).mul(n), r = T(e, t - 16).mul(D), i =
|
|
703
|
-
return J(
|
|
700
|
+
const n = D.add(t * 2), s = T(e, 0).mul(D), o = T(e, 8), a = T(e, t - 8).mul(n), r = T(e, t - 16).mul(D), i = A(s.add(o), 43).add(A(a, 30)).add(r), l = J(i, s.add(A(o.add(D), 18)).add(a), n), u = T(e, 16).mul(n), h = T(e, 24), f = i.add(T(e, t - 32)).mul(n), p = l.add(T(e, t - 24)).mul(n);
|
|
701
|
+
return J(A(u.add(h), 43).add(A(f, 30)).add(p), u.add(A(h.add(s), 18)).add(f), n);
|
|
704
702
|
}
|
|
705
|
-
function
|
|
703
|
+
function qn(e, t = e.length) {
|
|
706
704
|
const n = tt.fromNumber(81, !0);
|
|
707
705
|
if (t <= 32)
|
|
708
706
|
return t <= 16 ? On(e, t) : Ln(e, t);
|
|
709
707
|
if (t <= 64)
|
|
710
708
|
return Pn(e, t);
|
|
711
|
-
let s = n, o = n.mul(Y).add(113), a =
|
|
709
|
+
let s = n, o = n.mul(Y).add(113), a = bt(o.mul(D).add(113)).mul(D), r = [tt.UZERO, tt.UZERO], i = [tt.UZERO, tt.UZERO];
|
|
712
710
|
s = s.mul(D).add(T(e, 0));
|
|
713
711
|
let l = 0;
|
|
714
712
|
const u = (t - 1 >> 6) * 64, h = u + (t - 1 & 63) - 63;
|
|
715
713
|
do
|
|
716
|
-
s =
|
|
714
|
+
s = A(s.add(o).add(r[0]).add(T(e, l + 8)), 37).mul(Y), o = A(o.add(r[1]).add(T(e, l + 48)), 42).mul(Y), s = s.xor(i[1]), o = o.add(r[0]).add(T(e, l + 40)), a = A(a.add(i[0]), 33).mul(Y), r = ut(e, l, r[1].mul(Y), s.add(i[0])), i = ut(e, l + 32, a.add(i[1]), o.add(T(e, l + 16))), [a, s] = [s, a], l += 64;
|
|
717
715
|
while (l !== u);
|
|
718
716
|
const f = Y.add(a.and(255).shl(1));
|
|
719
|
-
return l = h, i[0] = i[0].add(t - 1 & 63), r[0] = r[0].add(i[0]), i[0] = i[0].add(r[0]), s =
|
|
717
|
+
return l = h, i[0] = i[0].add(t - 1 & 63), r[0] = r[0].add(i[0]), i[0] = i[0].add(r[0]), s = A(s.add(o).add(r[0]).add(T(e, l + 8)), 37).mul(f), o = A(o.add(r[1]).add(T(e, l + 48)), 42).mul(f), s = s.xor(i[1].mul(9)), o = o.add(r[0].mul(9).add(T(e, l + 40))), a = A(a.add(i[0]), 33).mul(f), r = ut(e, l, r[1].mul(f), s.add(i[0])), i = ut(e, l + 32, a.add(i[1]), o.add(T(e, l + 16))), [a, s] = [s, a], J(J(r[0], i[0], f).add(bt(o).mul(ae)).add(a), J(r[1], i[1], f).add(s), f);
|
|
720
718
|
}
|
|
721
719
|
function nt(e, t) {
|
|
722
720
|
Array.isArray(e) || (e = [e]), e.forEach((n) => {
|
|
723
|
-
n != null &&
|
|
721
|
+
n != null && Lt(n.dtype !== "complex64", () => `${t} does not support complex64 tensors in the CPU backend.`);
|
|
724
722
|
});
|
|
725
723
|
}
|
|
726
724
|
function le(e) {
|
|
@@ -729,28 +727,28 @@ function le(e) {
|
|
|
729
727
|
t[n] = Math.abs(e[n]);
|
|
730
728
|
return t;
|
|
731
729
|
}
|
|
732
|
-
const
|
|
730
|
+
const An = (e) => {
|
|
733
731
|
const { x: t } = e.inputs, n = e.backend;
|
|
734
732
|
nt(t, "abs");
|
|
735
733
|
let s = new Float32Array(V(t.shape));
|
|
736
734
|
const o = n.data.get(t.dataId).values;
|
|
737
735
|
return s = le(o), n.makeOutput(s, t.shape, t.dtype);
|
|
738
|
-
},
|
|
739
|
-
kernelName:
|
|
736
|
+
}, Js = {
|
|
737
|
+
kernelName: Ce,
|
|
740
738
|
backendName: "cpu",
|
|
741
|
-
kernelFunc:
|
|
739
|
+
kernelFunc: An
|
|
742
740
|
};
|
|
743
741
|
function U(e) {
|
|
744
742
|
return (t, n, s, o, a) => {
|
|
745
|
-
const r =
|
|
746
|
-
if (
|
|
743
|
+
const r = Pt(t, n), i = r.length, l = K(r), u = V(r), h = et(a, u), f = t.length, p = n.length, w = K(t), m = K(n), F = ht(t, r), d = ht(n, r);
|
|
744
|
+
if (F.length + d.length === 0)
|
|
747
745
|
for (let g = 0; g < h.length; ++g)
|
|
748
746
|
h[g] = e(s[g % s.length], o[g % o.length]);
|
|
749
747
|
else
|
|
750
748
|
for (let g = 0; g < h.length; ++g) {
|
|
751
|
-
const
|
|
752
|
-
|
|
753
|
-
const y = at(k, f, w), v =
|
|
749
|
+
const b = dt(g, i, l), k = b.slice(-f);
|
|
750
|
+
F.forEach((O) => k[O] = 0);
|
|
751
|
+
const y = at(k, f, w), v = b.slice(-p);
|
|
754
752
|
d.forEach((O) => v[O] = 0);
|
|
755
753
|
const M = at(v, p, m);
|
|
756
754
|
h[g] = e(s[y], o[M]);
|
|
@@ -765,34 +763,34 @@ function mt(e) {
|
|
|
765
763
|
imag: n.makeTensorInfo(o.shape, "float32", r)
|
|
766
764
|
}, i;
|
|
767
765
|
}
|
|
768
|
-
const
|
|
769
|
-
kernelName:
|
|
766
|
+
const Qs = {
|
|
767
|
+
kernelName: De,
|
|
770
768
|
backendName: "cpu",
|
|
771
769
|
kernelFunc: mt
|
|
772
770
|
};
|
|
773
|
-
function
|
|
771
|
+
function xt(e, t, n = "float32") {
|
|
774
772
|
if (n === "complex64") {
|
|
775
|
-
const o =
|
|
773
|
+
const o = xt(e, t, "float32"), a = xt(e, t, "float32");
|
|
776
774
|
return mt({ inputs: { real: o, imag: a }, backend: e });
|
|
777
775
|
}
|
|
778
776
|
const s = st(V(t), n);
|
|
779
777
|
return e.makeTensorInfo(t, n, s);
|
|
780
778
|
}
|
|
781
|
-
function
|
|
779
|
+
function Et(e) {
|
|
782
780
|
const { inputs: t, backend: n } = e, { x: s } = t;
|
|
783
781
|
return n.incRef(s.dataId), { dataId: s.dataId, shape: s.shape, dtype: s.dtype };
|
|
784
782
|
}
|
|
785
|
-
const
|
|
786
|
-
kernelName:
|
|
783
|
+
const Ys = {
|
|
784
|
+
kernelName: We,
|
|
787
785
|
backendName: "cpu",
|
|
788
|
-
kernelFunc:
|
|
786
|
+
kernelFunc: Et
|
|
789
787
|
};
|
|
790
788
|
function ce(e) {
|
|
791
789
|
const { inputs: t, backend: n } = e, { input: s } = t, o = n.data.get(s.dataId).complexTensorInfos.real, a = n.data.get(o.dataId).values;
|
|
792
790
|
return n.makeTensorInfo(o.shape, o.dtype, a);
|
|
793
791
|
}
|
|
794
|
-
const
|
|
795
|
-
kernelName:
|
|
792
|
+
const to = {
|
|
793
|
+
kernelName: Ue,
|
|
796
794
|
backendName: "cpu",
|
|
797
795
|
kernelFunc: ce
|
|
798
796
|
};
|
|
@@ -802,7 +800,7 @@ function ue(e, t, n, s) {
|
|
|
802
800
|
return [t, "int32", o];
|
|
803
801
|
}
|
|
804
802
|
if (s === "bool") {
|
|
805
|
-
const o =
|
|
803
|
+
const o = Be([0], n), [a, r] = U((i, l) => i !== l ? 1 : 0)(t, [], e, o, "bool");
|
|
806
804
|
return [r, "bool", a];
|
|
807
805
|
}
|
|
808
806
|
throw new Error(`Error in Cast: failed to cast ${n} to ${s}`);
|
|
@@ -811,23 +809,23 @@ function lt(e) {
|
|
|
811
809
|
const { inputs: t, backend: n, attrs: s } = e, { x: o } = t, { dtype: a } = s;
|
|
812
810
|
if (a === "complex64") {
|
|
813
811
|
if (o.dtype === "complex64")
|
|
814
|
-
return
|
|
815
|
-
const h =
|
|
812
|
+
return Et({ inputs: { x: o }, backend: n });
|
|
813
|
+
const h = xt(n, o.shape, o.dtype), f = lt({ inputs: { x: o }, backend: n, attrs: { dtype: "float32" } }), p = mt({ inputs: { real: f, imag: h }, backend: n });
|
|
816
814
|
return n.disposeIntermediateTensorInfo(h), n.disposeIntermediateTensorInfo(f), p;
|
|
817
815
|
}
|
|
818
816
|
if (o.dtype === "complex64") {
|
|
819
817
|
const h = ce({ inputs: { input: o }, backend: n }), f = lt({ inputs: { x: h }, backend: n, attrs: { dtype: a } });
|
|
820
818
|
return n.disposeIntermediateTensorInfo(h), f;
|
|
821
819
|
}
|
|
822
|
-
if (!
|
|
823
|
-
const h =
|
|
820
|
+
if (!ze(o.dtype, a)) {
|
|
821
|
+
const h = Et({ inputs: { x: o }, backend: n });
|
|
824
822
|
return { dataId: h.dataId, shape: h.shape, dtype: a };
|
|
825
823
|
}
|
|
826
824
|
const r = n.data.get(o.dataId).values, [i, l, u] = ue(r, o.shape, o.dtype, a);
|
|
827
825
|
return n.makeTensorInfo(i, l, u);
|
|
828
826
|
}
|
|
829
|
-
const
|
|
830
|
-
kernelName:
|
|
827
|
+
const eo = {
|
|
828
|
+
kernelName: $e,
|
|
831
829
|
backendName: "cpu",
|
|
832
830
|
kernelFunc: lt
|
|
833
831
|
};
|
|
@@ -841,40 +839,40 @@ function z(e, t, n, s) {
|
|
|
841
839
|
) : u, p = r.dtype === "string" ? (
|
|
842
840
|
// tslint:disable-next-line: no-any
|
|
843
841
|
it(h)
|
|
844
|
-
) : h, w = s || r.dtype, [m,
|
|
845
|
-
return l.makeTensorInfo(
|
|
842
|
+
) : h, w = s || r.dtype, [m, F] = t(r.shape, i.shape, f, p, w);
|
|
843
|
+
return l.makeTensorInfo(F, w, m);
|
|
846
844
|
} : ({ inputs: o, backend: a }) => {
|
|
847
845
|
const { a: r, b: i } = o, l = a;
|
|
848
846
|
if (r.dtype === "complex64" || i.dtype === "complex64") {
|
|
849
|
-
const u = lt({ inputs: { x: r }, backend: l, attrs: { dtype: "complex64" } }), h = l.data.get(u.dataId), f = h.complexTensorInfos.real, p = h.complexTensorInfos.imag, w = l.data.get(f.dataId).values, m = l.data.get(p.dataId).values,
|
|
850
|
-
return l.disposeIntermediateTensorInfo(u), l.disposeIntermediateTensorInfo(
|
|
847
|
+
const u = lt({ inputs: { x: r }, backend: l, attrs: { dtype: "complex64" } }), h = l.data.get(u.dataId), f = h.complexTensorInfos.real, p = h.complexTensorInfos.imag, w = l.data.get(f.dataId).values, m = l.data.get(p.dataId).values, F = lt({ inputs: { x: i }, backend: l, attrs: { dtype: "complex64" } }), d = l.data.get(F.dataId), g = d.complexTensorInfos.real, b = d.complexTensorInfos.imag, k = l.data.get(g.dataId).values, y = l.data.get(b.dataId).values, [v, M, O] = n(r.shape, i.shape, w, m, k, y), S = l.makeTensorInfo(O, "float32", v), x = l.makeTensorInfo(O, "float32", M), I = mt({ inputs: { real: S, imag: x }, backend: l });
|
|
848
|
+
return l.disposeIntermediateTensorInfo(u), l.disposeIntermediateTensorInfo(F), l.disposeIntermediateTensorInfo(S), l.disposeIntermediateTensorInfo(x), I;
|
|
851
849
|
} else {
|
|
852
850
|
const u = l.data.get(r.dataId).values, h = l.data.get(i.dataId).values, f = s || r.dtype, [p, w] = t(r.shape, i.shape, u, h, f);
|
|
853
851
|
return l.makeTensorInfo(w, f, p);
|
|
854
852
|
}
|
|
855
853
|
};
|
|
856
854
|
}
|
|
857
|
-
function
|
|
855
|
+
function Ft(e) {
|
|
858
856
|
return (t, n, s, o, a, r) => {
|
|
859
|
-
const i =
|
|
857
|
+
const i = Pt(t, n), l = V(i), u = i.length, h = K(i), f = et("float32", l), p = et("float32", l), w = ht(t, i), m = ht(n, i), F = Nt(s, o), d = Nt(a, r), g = t.length, b = K(t), k = n.length, y = K(n);
|
|
860
858
|
if (w.length + m.length === 0)
|
|
861
859
|
for (let v = 0; v < f.length; v++) {
|
|
862
|
-
const M = v %
|
|
860
|
+
const M = v % F.length, O = v % d.length, S = e(F[M * 2], F[M * 2 + 1], d[O * 2], d[O * 2 + 1]);
|
|
863
861
|
f[v] = S.real, p[v] = S.imag;
|
|
864
862
|
}
|
|
865
863
|
else
|
|
866
864
|
for (let v = 0; v < f.length; v++) {
|
|
867
865
|
const M = dt(v, u, h), O = M.slice(-g);
|
|
868
|
-
w.forEach((
|
|
869
|
-
const S = at(O, g,
|
|
870
|
-
m.forEach((
|
|
871
|
-
const I = at(
|
|
866
|
+
w.forEach((E) => O[E] = 0);
|
|
867
|
+
const S = at(O, g, b), x = M.slice(-k);
|
|
868
|
+
m.forEach((E) => x[E] = 0);
|
|
869
|
+
const I = at(x, k, y), c = e(F[S * 2], F[S * 2 + 1], d[I * 2], d[I * 2 + 1]);
|
|
872
870
|
f[v] = c.real, p[v] = c.imag;
|
|
873
871
|
}
|
|
874
872
|
return [f, p, i];
|
|
875
873
|
};
|
|
876
874
|
}
|
|
877
|
-
const he = U(((e, t) => e + t)), _n =
|
|
875
|
+
const he = U(((e, t) => e + t)), _n = Ft(((e, t, n, s) => ({ real: e + n, imag: t + s }))), Vn = z(qt, he, _n), no = {
|
|
878
876
|
kernelName: qt,
|
|
879
877
|
backendName: "cpu",
|
|
880
878
|
kernelFunc: Vn
|
|
@@ -900,8 +898,8 @@ function Dn(e, t, n, s = !1) {
|
|
|
900
898
|
}
|
|
901
899
|
return r;
|
|
902
900
|
}
|
|
903
|
-
const fe = U(((e, t) => e & t)), Wn = z(
|
|
904
|
-
kernelName:
|
|
901
|
+
const fe = U(((e, t) => e & t)), Wn = z(At, fe), so = {
|
|
902
|
+
kernelName: At,
|
|
905
903
|
backendName: "cpu",
|
|
906
904
|
kernelFunc: Wn
|
|
907
905
|
};
|
|
@@ -933,8 +931,8 @@ function Q(e, t, n) {
|
|
|
933
931
|
return i.makeTensorInfo(r.shape, h, f);
|
|
934
932
|
};
|
|
935
933
|
}
|
|
936
|
-
const ge = X((e) => Math.ceil(e)), Un = Q(
|
|
937
|
-
kernelName:
|
|
934
|
+
const ge = X((e) => Math.ceil(e)), Un = Q(_t, ge), oo = {
|
|
935
|
+
kernelName: _t,
|
|
938
936
|
backendName: "cpu",
|
|
939
937
|
kernelFunc: Un
|
|
940
938
|
};
|
|
@@ -961,28 +959,28 @@ function $n(e, t, n, s) {
|
|
|
961
959
|
}
|
|
962
960
|
return o;
|
|
963
961
|
}
|
|
964
|
-
const me = U((e, t) => e === t ? 1 : 0), zn = z(
|
|
965
|
-
kernelName:
|
|
962
|
+
const me = U((e, t) => e === t ? 1 : 0), zn = z(Vt, me, null, "bool"), ro = {
|
|
963
|
+
kernelName: Vt,
|
|
966
964
|
backendName: "cpu",
|
|
967
965
|
kernelFunc: zn
|
|
968
966
|
};
|
|
969
|
-
const pe = X((e) => Math.exp(e)), Bn = Q(
|
|
970
|
-
kernelName:
|
|
967
|
+
const pe = X((e) => Math.exp(e)), Bn = Q(Ct, pe, "float32"), ao = {
|
|
968
|
+
kernelName: Ct,
|
|
971
969
|
backendName: "cpu",
|
|
972
970
|
kernelFunc: Bn
|
|
973
971
|
};
|
|
974
|
-
const we = X((e) => Math.expm1(e)), jn = Q(
|
|
975
|
-
kernelName:
|
|
972
|
+
const we = X((e) => Math.expm1(e)), jn = Q(Dt, we), io = {
|
|
973
|
+
kernelName: Dt,
|
|
976
974
|
backendName: "cpu",
|
|
977
975
|
kernelFunc: jn
|
|
978
976
|
};
|
|
979
|
-
const Ie = X((e) => Math.floor(e)), Gn = Q(
|
|
980
|
-
kernelName:
|
|
977
|
+
const Ie = X((e) => Math.floor(e)), Gn = Q(Wt, Ie), lo = {
|
|
978
|
+
kernelName: Wt,
|
|
981
979
|
backendName: "cpu",
|
|
982
980
|
kernelFunc: Gn
|
|
983
981
|
};
|
|
984
|
-
const
|
|
985
|
-
kernelName:
|
|
982
|
+
const be = U((e, t) => Math.floor(e / t)), Zn = z(Ut, be, null, "int32"), co = {
|
|
983
|
+
kernelName: Ut,
|
|
986
984
|
backendName: "cpu",
|
|
987
985
|
kernelFunc: Zn
|
|
988
986
|
};
|
|
@@ -1012,23 +1010,23 @@ function Kn(e, t, n) {
|
|
|
1012
1010
|
}
|
|
1013
1011
|
return s;
|
|
1014
1012
|
}
|
|
1015
|
-
const
|
|
1016
|
-
kernelName:
|
|
1013
|
+
const xe = U((e, t) => e > t ? 1 : 0), Xn = z($t, xe, null, "bool"), uo = {
|
|
1014
|
+
kernelName: $t,
|
|
1017
1015
|
backendName: "cpu",
|
|
1018
1016
|
kernelFunc: Xn
|
|
1019
1017
|
};
|
|
1020
|
-
const
|
|
1021
|
-
kernelName:
|
|
1018
|
+
const Ee = U((e, t) => e >= t ? 1 : 0), Jn = z(zt, Ee, null, "bool"), ho = {
|
|
1019
|
+
kernelName: zt,
|
|
1022
1020
|
backendName: "cpu",
|
|
1023
1021
|
kernelFunc: Jn
|
|
1024
1022
|
};
|
|
1025
|
-
const
|
|
1026
|
-
kernelName:
|
|
1023
|
+
const Fe = U((e, t) => e < t ? 1 : 0), Qn = z(Bt, Fe, null, "bool"), fo = {
|
|
1024
|
+
kernelName: Bt,
|
|
1027
1025
|
backendName: "cpu",
|
|
1028
1026
|
kernelFunc: Qn
|
|
1029
1027
|
};
|
|
1030
|
-
const ye = U((e, t) => e <= t ? 1 : 0), Yn = z(
|
|
1031
|
-
kernelName:
|
|
1028
|
+
const ye = U((e, t) => e <= t ? 1 : 0), Yn = z(jt, ye, null, "bool"), go = {
|
|
1029
|
+
kernelName: jt,
|
|
1032
1030
|
backendName: "cpu",
|
|
1033
1031
|
kernelFunc: Yn
|
|
1034
1032
|
};
|
|
@@ -1039,8 +1037,8 @@ function ts(e, t, n) {
|
|
|
1039
1037
|
o[a] = o[a - 1] + s;
|
|
1040
1038
|
return o;
|
|
1041
1039
|
}
|
|
1042
|
-
const ke = X((e) => Math.log(e)), es = Q(
|
|
1043
|
-
kernelName:
|
|
1040
|
+
const ke = X((e) => Math.log(e)), es = Q(Gt, ke), mo = {
|
|
1041
|
+
kernelName: Gt,
|
|
1044
1042
|
backendName: "cpu",
|
|
1045
1043
|
kernelFunc: es
|
|
1046
1044
|
};
|
|
@@ -1057,26 +1055,26 @@ function ns(e, t, n, s) {
|
|
|
1057
1055
|
}
|
|
1058
1056
|
return o;
|
|
1059
1057
|
}
|
|
1060
|
-
const Ne = U(((e, t) => Math.max(e, t))), ss = z(
|
|
1061
|
-
kernelName:
|
|
1058
|
+
const Ne = U(((e, t) => Math.max(e, t))), ss = z(Zt, Ne), po = {
|
|
1059
|
+
kernelName: Zt,
|
|
1062
1060
|
backendName: "cpu",
|
|
1063
1061
|
kernelFunc: ss
|
|
1064
1062
|
};
|
|
1065
|
-
const ve = U(((e, t) => Math.min(e, t))), os = z(
|
|
1066
|
-
kernelName:
|
|
1063
|
+
const ve = U(((e, t) => Math.min(e, t))), os = z(Ht, ve), wo = {
|
|
1064
|
+
kernelName: Ht,
|
|
1067
1065
|
backendName: "cpu",
|
|
1068
1066
|
kernelFunc: os
|
|
1069
1067
|
};
|
|
1070
|
-
const yt = U(((e, t) => e * t)), rs =
|
|
1068
|
+
const yt = U(((e, t) => e * t)), rs = Ft(((e, t, n, s) => ({
|
|
1071
1069
|
real: e * n - t * s,
|
|
1072
1070
|
imag: e * s + t * n
|
|
1073
|
-
}))), as = z(
|
|
1074
|
-
kernelName:
|
|
1071
|
+
}))), as = z(Kt, yt, rs), Io = {
|
|
1072
|
+
kernelName: Kt,
|
|
1075
1073
|
backendName: "cpu",
|
|
1076
1074
|
kernelFunc: as
|
|
1077
1075
|
};
|
|
1078
1076
|
function Se(e, t, n) {
|
|
1079
|
-
const s =
|
|
1077
|
+
const s = Ge(-1, n);
|
|
1080
1078
|
return yt([], t, s, e, n);
|
|
1081
1079
|
}
|
|
1082
1080
|
function is(e) {
|
|
@@ -1085,13 +1083,13 @@ function is(e) {
|
|
|
1085
1083
|
const o = n.data.get(s.dataId).values, [a, r] = Se(o, s.shape, s.dtype);
|
|
1086
1084
|
return n.makeTensorInfo(r, s.dtype, a);
|
|
1087
1085
|
}
|
|
1088
|
-
const
|
|
1089
|
-
kernelName:
|
|
1086
|
+
const bo = {
|
|
1087
|
+
kernelName: je,
|
|
1090
1088
|
backendName: "cpu",
|
|
1091
1089
|
kernelFunc: is
|
|
1092
1090
|
};
|
|
1093
|
-
const Te = U(((e, t) => e !== t ? 1 : 0)), ls = z(
|
|
1094
|
-
kernelName:
|
|
1091
|
+
const Te = U(((e, t) => e !== t ? 1 : 0)), ls = z(Xt, Te, null, "bool"), xo = {
|
|
1092
|
+
kernelName: Xt,
|
|
1095
1093
|
backendName: "cpu",
|
|
1096
1094
|
kernelFunc: ls
|
|
1097
1095
|
};
|
|
@@ -1115,13 +1113,13 @@ function Me(e) {
|
|
|
1115
1113
|
const l = s.data.get(o.dataId).values, u = Re(l, o.shape, o.dtype, a, i);
|
|
1116
1114
|
return { dataId: s.write(u, i, o.dtype), shape: i, dtype: o.dtype };
|
|
1117
1115
|
}
|
|
1118
|
-
const
|
|
1119
|
-
kernelName:
|
|
1116
|
+
const Eo = {
|
|
1117
|
+
kernelName: Ze,
|
|
1120
1118
|
backendName: "cpu",
|
|
1121
1119
|
kernelFunc: Me
|
|
1122
1120
|
};
|
|
1123
1121
|
function Oe(e, t, n, s) {
|
|
1124
|
-
const [o, a] =
|
|
1122
|
+
const [o, a] = bn(e, s), r = Ke(t, "int32"), i = st(V(o), r), l = V(a);
|
|
1125
1123
|
for (let u = 0; u < i.length; ++u) {
|
|
1126
1124
|
const h = u * l;
|
|
1127
1125
|
let f = 1;
|
|
@@ -1134,16 +1132,16 @@ function Oe(e, t, n, s) {
|
|
|
1134
1132
|
function cs(e) {
|
|
1135
1133
|
const { inputs: t, backend: n, attrs: s } = e, { x: o } = t, { axis: a, keepDims: r } = s;
|
|
1136
1134
|
nt(o, "prod");
|
|
1137
|
-
const i = o.shape.length, l =
|
|
1135
|
+
const i = o.shape.length, l = Jt(a, o.shape), u = pn(l, i);
|
|
1138
1136
|
let h = l, f = o;
|
|
1139
1137
|
const p = [];
|
|
1140
1138
|
u != null && (f = Me({ inputs: { x: o }, backend: n, attrs: { perm: u } }), p.push(f), h = wn(h.length, i));
|
|
1141
|
-
const w = n.data.get(f.dataId).values, { outVals: m, outShape:
|
|
1142
|
-
let g =
|
|
1143
|
-
return r && (g = In(
|
|
1139
|
+
const w = n.data.get(f.dataId).values, { outVals: m, outShape: F, outDtype: d } = Oe(f.shape, f.dtype, w, h);
|
|
1140
|
+
let g = F;
|
|
1141
|
+
return r && (g = In(F, l)), p.forEach((b) => n.disposeIntermediateTensorInfo(b)), n.makeTensorInfo(g, d, m);
|
|
1144
1142
|
}
|
|
1145
|
-
const
|
|
1146
|
-
kernelName:
|
|
1143
|
+
const Fo = {
|
|
1144
|
+
kernelName: He,
|
|
1147
1145
|
backendName: "cpu",
|
|
1148
1146
|
kernelFunc: cs
|
|
1149
1147
|
};
|
|
@@ -1186,7 +1184,7 @@ function fs(e, t, n, s) {
|
|
|
1186
1184
|
for (let p = 0; p < n.length; ++p) {
|
|
1187
1185
|
const w = n[p], m = p + t.length - 1;
|
|
1188
1186
|
if (m >= 0) {
|
|
1189
|
-
const
|
|
1187
|
+
const F = i[m], d = F[F.length - 1] - w[h];
|
|
1190
1188
|
for (let g = h; g < f; ++g)
|
|
1191
1189
|
i[m].push(w[g + 1] + d);
|
|
1192
1190
|
}
|
|
@@ -1255,24 +1253,24 @@ function ws(e, t, n, s, o, a, r) {
|
|
|
1255
1253
|
const f = h.length === 0 ? 1 : h[0], p = W("int32", f + 1);
|
|
1256
1254
|
p[0] = 0;
|
|
1257
1255
|
for (let d = 0; d < f; ++d) {
|
|
1258
|
-
const g = i ? e[0] : e[d],
|
|
1256
|
+
const g = i ? e[0] : e[d], b = l ? s[0] : s[d], k = u ? a[0] : a[d];
|
|
1259
1257
|
if (k === 0)
|
|
1260
1258
|
throw new Error("Requires delta != 0");
|
|
1261
1259
|
let y;
|
|
1262
|
-
if (k > 0 &&
|
|
1260
|
+
if (k > 0 && b < g || k < 0 && b > g)
|
|
1263
1261
|
y = 0;
|
|
1264
|
-
else if (y = Math.ceil(Math.abs((
|
|
1262
|
+
else if (y = Math.ceil(Math.abs((b - g) / k)), y > Rt)
|
|
1265
1263
|
throw new Error(`Requires ((limit - start) / delta) <= ${Rt}`);
|
|
1266
1264
|
p[d + 1] = p[d] + y;
|
|
1267
1265
|
}
|
|
1268
1266
|
const w = p[f], m = W(n, w);
|
|
1269
|
-
let
|
|
1267
|
+
let F = 0;
|
|
1270
1268
|
for (let d = 0; d < f; ++d) {
|
|
1271
1269
|
const g = p[d + 1] - p[d];
|
|
1272
|
-
let
|
|
1270
|
+
let b = i ? e[0] : e[d];
|
|
1273
1271
|
const k = u ? a[0] : a[d];
|
|
1274
1272
|
for (let y = 0; y < g; ++y)
|
|
1275
|
-
m[
|
|
1273
|
+
m[F++] = b, b += k;
|
|
1276
1274
|
}
|
|
1277
1275
|
return [p, m];
|
|
1278
1276
|
}
|
|
@@ -1355,7 +1353,7 @@ class ft {
|
|
|
1355
1353
|
a.push(r);
|
|
1356
1354
|
for (let i = o; i < t; ++i)
|
|
1357
1355
|
a.push(-1);
|
|
1358
|
-
return
|
|
1356
|
+
return Lt(a.length === t, () => "Final length of result must be equal to firstDimension."), a;
|
|
1359
1357
|
}
|
|
1360
1358
|
calculateOutputIndexRowSplit(t, n, s, o) {
|
|
1361
1359
|
const a = t.length, r = [];
|
|
@@ -1472,35 +1470,35 @@ class ft {
|
|
|
1472
1470
|
let h = this.defaultValue;
|
|
1473
1471
|
if (h.length !== l && h.length !== 1) {
|
|
1474
1472
|
const m = this.defaultValueShape;
|
|
1475
|
-
|
|
1476
|
-
const
|
|
1477
|
-
h =
|
|
1473
|
+
Xe(() => {
|
|
1474
|
+
const F = En(h, m);
|
|
1475
|
+
h = xn(F, i).dataSync();
|
|
1478
1476
|
});
|
|
1479
1477
|
}
|
|
1480
1478
|
let f = 0, p = 0, w = 0;
|
|
1481
1479
|
for (let m = 0; m <= u; ++m) {
|
|
1482
|
-
let
|
|
1483
|
-
if (
|
|
1480
|
+
let F = m < u ? n[m] : -1;
|
|
1481
|
+
if (F === w) {
|
|
1484
1482
|
++w;
|
|
1485
1483
|
continue;
|
|
1486
1484
|
}
|
|
1487
1485
|
if (p < w) {
|
|
1488
|
-
const d = a.subarray(f * l), g = r.subarray(p * l),
|
|
1489
|
-
Mt(g, d,
|
|
1486
|
+
const d = a.subarray(f * l), g = r.subarray(p * l), b = (w - p) * l;
|
|
1487
|
+
Mt(g, d, b);
|
|
1490
1488
|
}
|
|
1491
1489
|
if (m >= u) {
|
|
1492
1490
|
const d = s.length;
|
|
1493
|
-
|
|
1491
|
+
F = Math.floor(d / l);
|
|
1494
1492
|
}
|
|
1495
|
-
if (
|
|
1493
|
+
if (F > w)
|
|
1496
1494
|
if (this.defaultValue.length === 1)
|
|
1497
|
-
r.subarray(w * l,
|
|
1495
|
+
r.subarray(w * l, F * l).fill(this.defaultValue[0]), w = F;
|
|
1498
1496
|
else
|
|
1499
|
-
for (;
|
|
1497
|
+
for (; F > w; ) {
|
|
1500
1498
|
const d = r.slice(w * l);
|
|
1501
1499
|
Mt(d, h, l), ++w;
|
|
1502
1500
|
}
|
|
1503
|
-
|
|
1501
|
+
F < 0 ? (f = m + 1, p = w) : (f = m, p = w, w = p + 1);
|
|
1504
1502
|
}
|
|
1505
1503
|
}
|
|
1506
1504
|
}
|
|
@@ -1525,7 +1523,7 @@ function Ot(e, t) {
|
|
|
1525
1523
|
function Is(e, t, n, s, o, a, r, i, l, u) {
|
|
1526
1524
|
return new ft(e, t, n, s, o, a, r, i, l, u).compute();
|
|
1527
1525
|
}
|
|
1528
|
-
function
|
|
1526
|
+
function bs(e, t, n, s) {
|
|
1529
1527
|
const o = e === t, a = e < t && n < 0, r = t < e && n > 1;
|
|
1530
1528
|
if (o || a || r)
|
|
1531
1529
|
return st(0, s);
|
|
@@ -1535,32 +1533,32 @@ function xs(e, t, n, s) {
|
|
|
1535
1533
|
l[u] = l[u - 1] + n;
|
|
1536
1534
|
return l;
|
|
1537
1535
|
}
|
|
1538
|
-
const Le = X((e) => 1 / Math.sqrt(e)),
|
|
1536
|
+
const Le = X((e) => 1 / Math.sqrt(e)), xs = Q(Qt, Le), yo = {
|
|
1539
1537
|
kernelName: Qt,
|
|
1540
1538
|
backendName: "cpu",
|
|
1541
|
-
kernelFunc:
|
|
1539
|
+
kernelFunc: xs
|
|
1542
1540
|
};
|
|
1543
|
-
function
|
|
1541
|
+
function Es(e, t, n, s, o, a, r, i, l, u) {
|
|
1544
1542
|
const h = [s / o, o], f = e.values, p = t.values;
|
|
1545
1543
|
if (s === 0)
|
|
1546
1544
|
return H(n, t.dtype);
|
|
1547
1545
|
const w = l instanceof It ? l : H(h, t.dtype);
|
|
1548
1546
|
typeof l == "string" || typeof l == "number" ? w.values.fill(l) : typeof l == "boolean" && w.values.fill(+l);
|
|
1549
1547
|
for (let m = 0; m < a; m++) {
|
|
1550
|
-
const
|
|
1548
|
+
const F = [];
|
|
1551
1549
|
let d = 0;
|
|
1552
1550
|
for (let g = 0; g < r; g++) {
|
|
1553
|
-
const
|
|
1554
|
-
|
|
1551
|
+
const b = f[m * r + g];
|
|
1552
|
+
F.push(b), d += b * i[g];
|
|
1555
1553
|
}
|
|
1556
1554
|
if (d < 0 || d >= s / o)
|
|
1557
|
-
throw new Error(`Invalid indices: ${
|
|
1555
|
+
throw new Error(`Invalid indices: ${F} does not index into ${n}`);
|
|
1558
1556
|
for (let g = 0; g < o; g++)
|
|
1559
1557
|
u ? w.values[d * o + g] += p[m * o + g] : w.values[d * o + g] = t.rank === 0 ? p[0] : p[m * o + g];
|
|
1560
1558
|
}
|
|
1561
1559
|
return w;
|
|
1562
1560
|
}
|
|
1563
|
-
const
|
|
1561
|
+
const Fs = X((e) => 1 / (1 + Math.exp(-e))), ys = de(Yt, (e) => 1 / (1 + Math.exp(-e))), ko = {
|
|
1564
1562
|
kernelName: Yt,
|
|
1565
1563
|
backendName: "cpu",
|
|
1566
1564
|
kernelFunc: ys
|
|
@@ -1573,7 +1571,7 @@ function Pe(e, t, n, s, o) {
|
|
|
1573
1571
|
}
|
|
1574
1572
|
const l = o === "string" ? it(e) : e, u = H(s, o, l), h = H(n, o);
|
|
1575
1573
|
for (let f = 0; f < h.size; ++f) {
|
|
1576
|
-
const p = h.indexToLoc(f), w = p.map((m,
|
|
1574
|
+
const p = h.indexToLoc(f), w = p.map((m, F) => m + t[F]);
|
|
1577
1575
|
h.set(u.get(...w), ...p);
|
|
1578
1576
|
}
|
|
1579
1577
|
return o === "string" ? sn(h.values) : h.values;
|
|
@@ -1581,12 +1579,12 @@ function Pe(e, t, n, s, o) {
|
|
|
1581
1579
|
function ks(e) {
|
|
1582
1580
|
const { inputs: t, backend: n, attrs: s } = e, { x: o } = t, { begin: a, size: r } = s;
|
|
1583
1581
|
nt(o, "slice");
|
|
1584
|
-
const [i, l] =
|
|
1582
|
+
const [i, l] = Fn(o, a, r);
|
|
1585
1583
|
yn(o, i, l);
|
|
1586
1584
|
const u = n.data.get(o.dataId).values, h = Pe(u, i, l, o.shape, o.dtype);
|
|
1587
1585
|
return n.makeTensorInfo(l, o.dtype, h);
|
|
1588
1586
|
}
|
|
1589
|
-
const
|
|
1587
|
+
const No = {
|
|
1590
1588
|
kernelName: Je,
|
|
1591
1589
|
backendName: "cpu",
|
|
1592
1590
|
kernelFunc: ks
|
|
@@ -1615,15 +1613,15 @@ function Ns(e, t, n, s, o, a, r) {
|
|
|
1615
1613
|
throw new Error(an(d, g, l));
|
|
1616
1614
|
++m[g], p = p && g >= w, w = g;
|
|
1617
1615
|
}
|
|
1618
|
-
let
|
|
1616
|
+
let F = !0;
|
|
1619
1617
|
for (let d = 0; d < l; ++d) {
|
|
1620
1618
|
const g = m[d] === 0;
|
|
1621
|
-
u[d] = g,
|
|
1619
|
+
u[d] = g, F = F && !g, m[d] = Math.max(m[d], 1), d > 0 && (m[d] += m[d - 1]);
|
|
1622
1620
|
}
|
|
1623
|
-
if (
|
|
1621
|
+
if (F && p) {
|
|
1624
1622
|
const d = e, g = s;
|
|
1625
|
-
for (let
|
|
1626
|
-
h[
|
|
1623
|
+
for (let b = 0; b < i; ++b)
|
|
1624
|
+
h[b] = b;
|
|
1627
1625
|
return [
|
|
1628
1626
|
d,
|
|
1629
1627
|
[i, f],
|
|
@@ -1632,13 +1630,13 @@ function Ns(e, t, n, s, o, a, r) {
|
|
|
1632
1630
|
h
|
|
1633
1631
|
];
|
|
1634
1632
|
} else {
|
|
1635
|
-
const d = m[l - 1], g = W(n, d * f),
|
|
1633
|
+
const d = m[l - 1], g = W(n, d * f), b = W(o, d), k = new Array(l).fill(0);
|
|
1636
1634
|
for (let y = 0; y < i; ++y) {
|
|
1637
1635
|
const v = e[y * f], M = k[v], O = (v === 0 ? 0 : m[v - 1]) + M;
|
|
1638
1636
|
k[v]++;
|
|
1639
1637
|
for (let S = 0; S < f; ++S)
|
|
1640
1638
|
g[O * f + S] = e[y * f + S];
|
|
1641
|
-
|
|
1639
|
+
b[O] = s[y], h[y] = O;
|
|
1642
1640
|
}
|
|
1643
1641
|
for (let y = 0; y < l; ++y)
|
|
1644
1642
|
if (k[y] === 0) {
|
|
@@ -1646,12 +1644,12 @@ function Ns(e, t, n, s, o, a, r) {
|
|
|
1646
1644
|
g[M * f + 0] = y;
|
|
1647
1645
|
for (let O = 1; O < f; ++O)
|
|
1648
1646
|
g[M * f + O] = 0;
|
|
1649
|
-
|
|
1647
|
+
b[M] = r;
|
|
1650
1648
|
}
|
|
1651
1649
|
return [
|
|
1652
1650
|
g,
|
|
1653
1651
|
[d, f],
|
|
1654
|
-
|
|
1652
|
+
b,
|
|
1655
1653
|
u,
|
|
1656
1654
|
h
|
|
1657
1655
|
];
|
|
@@ -1694,15 +1692,15 @@ function vs(e, t, n, s, o) {
|
|
|
1694
1692
|
for (let d = i - 2; d >= 0; --d)
|
|
1695
1693
|
m[d] = m[d + 1] * l[d + 1];
|
|
1696
1694
|
}
|
|
1697
|
-
const
|
|
1695
|
+
const F = W(n, r * i);
|
|
1698
1696
|
for (let d = 0; d < r; ++d) {
|
|
1699
1697
|
let g = 0;
|
|
1700
|
-
for (let
|
|
1701
|
-
g += e[d * p +
|
|
1702
|
-
for (let
|
|
1703
|
-
|
|
1698
|
+
for (let b = 0; b < p; ++b)
|
|
1699
|
+
g += e[d * p + b] * w[b];
|
|
1700
|
+
for (let b = 0; b < i; ++b)
|
|
1701
|
+
F[d * i + b] = Math.trunc(g / m[b]), g %= m[b];
|
|
1704
1702
|
}
|
|
1705
|
-
return [
|
|
1703
|
+
return [F, [r, i], l];
|
|
1706
1704
|
}
|
|
1707
1705
|
function Ss(e, t, n, s, o, a = !1, r = 0) {
|
|
1708
1706
|
const i = s.length, l = [t[0], e.length / t[0]], u = l[1], f = i > 0 ? o[i - 1] + 1 : 0;
|
|
@@ -1715,52 +1713,52 @@ function Ss(e, t, n, s, o, a = !1, r = 0) {
|
|
|
1715
1713
|
return f > 0 && m.fill(r), [m, p];
|
|
1716
1714
|
if (f <= 0)
|
|
1717
1715
|
throw new Error(kt());
|
|
1718
|
-
let
|
|
1716
|
+
let F = 0, d = 1, g = 0, b = o[F];
|
|
1719
1717
|
for (; ; ) {
|
|
1720
1718
|
let k = 0;
|
|
1721
1719
|
if (d < i) {
|
|
1722
|
-
if (k = o[d],
|
|
1720
|
+
if (k = o[d], b === k) {
|
|
1723
1721
|
++d;
|
|
1724
1722
|
continue;
|
|
1725
1723
|
}
|
|
1726
|
-
if (
|
|
1724
|
+
if (b >= k)
|
|
1727
1725
|
throw new Error(dn());
|
|
1728
1726
|
}
|
|
1729
|
-
if (
|
|
1730
|
-
throw new Error(gn(
|
|
1731
|
-
|
|
1732
|
-
for (let y =
|
|
1727
|
+
if (b < 0 || b >= f)
|
|
1728
|
+
throw new Error(gn(b, f));
|
|
1729
|
+
b > g && m.fill(r, g * u, b * u);
|
|
1730
|
+
for (let y = F; y < d; ++y) {
|
|
1733
1731
|
const v = s[y];
|
|
1734
1732
|
if (v < 0 || v >= l[0])
|
|
1735
1733
|
throw new Error(mn(y, s[y], l[0]));
|
|
1736
1734
|
for (let M = 0; M < u; M++)
|
|
1737
|
-
m[
|
|
1735
|
+
m[b * u + M] += e[v * u + M];
|
|
1738
1736
|
}
|
|
1739
1737
|
if (a)
|
|
1740
1738
|
for (let y = 0; y < u; y++)
|
|
1741
|
-
m[
|
|
1742
|
-
if (
|
|
1739
|
+
m[b * u + y] /= d - F;
|
|
1740
|
+
if (F = d, ++d, g = b + 1, b = k, d > i)
|
|
1743
1741
|
break;
|
|
1744
1742
|
}
|
|
1745
1743
|
return g < f && m.fill(r, g * u, f * u), [m, p];
|
|
1746
1744
|
}
|
|
1747
|
-
const Ts = X((e) => Math.sqrt(e)), Rs = de(te, (e) => Math.sqrt(e)),
|
|
1745
|
+
const Ts = X((e) => Math.sqrt(e)), Rs = de(te, (e) => Math.sqrt(e)), vo = {
|
|
1748
1746
|
kernelName: te,
|
|
1749
1747
|
backendName: "cpu",
|
|
1750
1748
|
kernelFunc: Rs
|
|
1751
1749
|
};
|
|
1752
|
-
const
|
|
1750
|
+
const qe = U(((e, t) => {
|
|
1753
1751
|
const n = e - t;
|
|
1754
1752
|
return n * n;
|
|
1755
|
-
})), Ms = z(ee,
|
|
1753
|
+
})), Ms = z(ee, qe), So = {
|
|
1756
1754
|
kernelName: ee,
|
|
1757
1755
|
backendName: "cpu",
|
|
1758
1756
|
kernelFunc: Ms
|
|
1759
1757
|
};
|
|
1760
|
-
const
|
|
1758
|
+
const Ae = X((e, t) => {
|
|
1761
1759
|
const { pattern: n, replaceGlobal: s, rewrite: o } = t;
|
|
1762
1760
|
return e.replace(new RegExp(n, s ? "g" : ""), o);
|
|
1763
|
-
}), Os = Q(ne,
|
|
1761
|
+
}), Os = Q(ne, Ae), To = {
|
|
1764
1762
|
kernelName: ne,
|
|
1765
1763
|
backendName: "cpu",
|
|
1766
1764
|
kernelFunc: Os
|
|
@@ -1791,24 +1789,24 @@ class Ps {
|
|
|
1791
1789
|
const l = this.getPadWidth(r), u = Math.max(0, l - i), h = Math.max(0, l - (a - (i + 1))), f = r - (u + h), p = n + (u > 0 ? 0 : i - l);
|
|
1792
1790
|
let w = 0;
|
|
1793
1791
|
w += u * this.leftPad.length;
|
|
1794
|
-
for (let
|
|
1795
|
-
w += t[p +
|
|
1792
|
+
for (let b = 0; b < f; ++b)
|
|
1793
|
+
w += t[p + b].length;
|
|
1796
1794
|
w += h * this.rightPad.length;
|
|
1797
1795
|
const m = u + h + f - 1;
|
|
1798
1796
|
w += m * this.separator.length, s[o + i] = new Uint8Array(w);
|
|
1799
|
-
const
|
|
1797
|
+
const F = s[o + i];
|
|
1800
1798
|
let d = 0;
|
|
1801
|
-
const g = (
|
|
1802
|
-
for (let
|
|
1799
|
+
const g = (b) => b.forEach((k) => F[d++] = k);
|
|
1800
|
+
for (let b = 0; b < u; ++b)
|
|
1803
1801
|
g(this.leftPad), g(this.separator);
|
|
1804
|
-
for (let
|
|
1805
|
-
g(t[p +
|
|
1802
|
+
for (let b = 0; b < f - 1; ++b)
|
|
1803
|
+
g(t[p + b]), g(this.separator);
|
|
1806
1804
|
if (f > 0) {
|
|
1807
1805
|
g(t[p + f - 1]);
|
|
1808
|
-
for (let
|
|
1806
|
+
for (let b = 0; b < h; ++b)
|
|
1809
1807
|
g(this.separator), g(this.rightPad);
|
|
1810
1808
|
} else {
|
|
1811
|
-
for (let
|
|
1809
|
+
for (let b = 0; b < h - 1; ++b)
|
|
1812
1810
|
g(this.rightPad), g(this.separator);
|
|
1813
1811
|
g(this.rightPad);
|
|
1814
1812
|
}
|
|
@@ -1865,10 +1863,10 @@ class Ps {
|
|
|
1865
1863
|
return [i, r];
|
|
1866
1864
|
}
|
|
1867
1865
|
}
|
|
1868
|
-
function
|
|
1866
|
+
function qs(e, t, n, s, o, a, r, i) {
|
|
1869
1867
|
return new Ps(n, s, o, a, r, i).compute(e, t);
|
|
1870
1868
|
}
|
|
1871
|
-
function
|
|
1869
|
+
function As(e, t, n, s) {
|
|
1872
1870
|
if (!e.length)
|
|
1873
1871
|
return;
|
|
1874
1872
|
if (t.length === 0) {
|
|
@@ -1899,7 +1897,7 @@ function _s(e, t, n) {
|
|
|
1899
1897
|
const i = new Array(s);
|
|
1900
1898
|
for (let p = 0; p < s; ++p) {
|
|
1901
1899
|
const w = o.length;
|
|
1902
|
-
|
|
1900
|
+
As(e[p], t, n, o);
|
|
1903
1901
|
const m = o.length - w;
|
|
1904
1902
|
i[p] = m, a += m, r = Math.max(r, m);
|
|
1905
1903
|
}
|
|
@@ -1913,10 +1911,10 @@ function _s(e, t, n) {
|
|
|
1913
1911
|
function Vs(e, t) {
|
|
1914
1912
|
const n = W("int32", e.length);
|
|
1915
1913
|
for (let s = 0; s < e.length; ++s)
|
|
1916
|
-
n[s] =
|
|
1914
|
+
n[s] = qn(e[s]).modulo(t).getLowBitsUnsigned();
|
|
1917
1915
|
return n;
|
|
1918
1916
|
}
|
|
1919
|
-
const _e = U(((e, t) => e - t)), Cs =
|
|
1917
|
+
const _e = U(((e, t) => e - t)), Cs = Ft(((e, t, n, s) => ({ real: e - n, imag: t - s }))), Ds = z(se, _e, Cs), Ro = {
|
|
1920
1918
|
kernelName: se,
|
|
1921
1919
|
backendName: "cpu",
|
|
1922
1920
|
kernelFunc: Ds
|
|
@@ -1961,10 +1959,10 @@ function Us(e, t, n, s, o) {
|
|
|
1961
1959
|
for (let f = 0; f < r; f++) {
|
|
1962
1960
|
const p = f * i, w = e.subarray(p, p + i);
|
|
1963
1961
|
let m = new Array(w.length);
|
|
1964
|
-
w.forEach((
|
|
1965
|
-
const
|
|
1966
|
-
for (let
|
|
1967
|
-
d[
|
|
1962
|
+
w.forEach((b, k) => m[k] = { value: b, index: k }), s < m.length && (Ve(m, s), m = m.slice(0, s)), o && m.sort(rt);
|
|
1963
|
+
const F = f * s, d = l.subarray(F, F + s), g = u.subarray(F, F + s);
|
|
1964
|
+
for (let b = 0; b < s; b++)
|
|
1965
|
+
d[b] = m[b].value, g[b] = m[b].index;
|
|
1968
1966
|
}
|
|
1969
1967
|
const h = t.slice();
|
|
1970
1968
|
return h[h.length - 1] = s, [
|
|
@@ -1973,7 +1971,7 @@ function Us(e, t, n, s, o) {
|
|
|
1973
1971
|
];
|
|
1974
1972
|
}
|
|
1975
1973
|
function $s(e, t, n, s) {
|
|
1976
|
-
const o =
|
|
1974
|
+
const o = Jt(t, n)[0], a = [1, n[0], 1];
|
|
1977
1975
|
for (let m = 0; m < o; m++)
|
|
1978
1976
|
a[0] *= n[m];
|
|
1979
1977
|
a[1] = n[o];
|
|
@@ -1981,31 +1979,31 @@ function $s(e, t, n, s) {
|
|
|
1981
1979
|
a[2] *= n[m];
|
|
1982
1980
|
const r = /* @__PURE__ */ new Map(), i = new Int32Array(n[o]), l = new It(a, s, e), u = [], h = a[0] === 1 && a[2] === 1;
|
|
1983
1981
|
for (let m = 0; m < n[o]; m++) {
|
|
1984
|
-
let
|
|
1982
|
+
let F;
|
|
1985
1983
|
if (h)
|
|
1986
|
-
|
|
1984
|
+
F = e[m].toString();
|
|
1987
1985
|
else {
|
|
1988
1986
|
const g = [];
|
|
1989
|
-
for (let
|
|
1987
|
+
for (let b = 0; b < a[0]; b++)
|
|
1990
1988
|
for (let k = 0; k < a[2]; k++)
|
|
1991
|
-
g.push(l.get(
|
|
1992
|
-
|
|
1989
|
+
g.push(l.get(b, m, k));
|
|
1990
|
+
F = g.join(",");
|
|
1993
1991
|
}
|
|
1994
|
-
const d = r.get(
|
|
1992
|
+
const d = r.get(F);
|
|
1995
1993
|
if (d != null)
|
|
1996
1994
|
i[m] = d;
|
|
1997
1995
|
else {
|
|
1998
1996
|
const g = r.size;
|
|
1999
|
-
r.set(
|
|
1997
|
+
r.set(F, g), i[m] = g, u.push(m);
|
|
2000
1998
|
}
|
|
2001
1999
|
}
|
|
2002
2000
|
const f = a.slice();
|
|
2003
2001
|
f[1] = r.size;
|
|
2004
2002
|
const p = new It(f, s);
|
|
2005
|
-
u.forEach((m,
|
|
2003
|
+
u.forEach((m, F) => {
|
|
2006
2004
|
for (let d = 0; d < a[0]; d++)
|
|
2007
2005
|
for (let g = 0; g < a[2]; g++)
|
|
2008
|
-
p.set(l.get(d, m, g), d,
|
|
2006
|
+
p.set(l.get(d, m, g), d, F, g);
|
|
2009
2007
|
});
|
|
2010
2008
|
const w = n.slice();
|
|
2011
2009
|
return w[o] = f[1], {
|
|
@@ -2014,7 +2012,7 @@ function $s(e, t, n, s) {
|
|
|
2014
2012
|
indices: i
|
|
2015
2013
|
};
|
|
2016
2014
|
}
|
|
2017
|
-
const
|
|
2015
|
+
const Mo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2018
2016
|
__proto__: null,
|
|
2019
2017
|
addImpl: he,
|
|
2020
2018
|
bincountImpl: Cn,
|
|
@@ -2026,14 +2024,14 @@ const Lo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2026
2024
|
equalImpl: me,
|
|
2027
2025
|
expImpl: pe,
|
|
2028
2026
|
expm1Impl: we,
|
|
2029
|
-
floorDivImpl:
|
|
2027
|
+
floorDivImpl: be,
|
|
2030
2028
|
floorImpl: Ie,
|
|
2031
2029
|
gatherNdImpl: Hn,
|
|
2032
2030
|
gatherV2Impl: Kn,
|
|
2033
|
-
greaterEqualImpl:
|
|
2034
|
-
greaterImpl:
|
|
2031
|
+
greaterEqualImpl: Ee,
|
|
2032
|
+
greaterImpl: xe,
|
|
2035
2033
|
lessEqualImpl: ye,
|
|
2036
|
-
lessImpl:
|
|
2034
|
+
lessImpl: Fe,
|
|
2037
2035
|
linSpaceImpl: ts,
|
|
2038
2036
|
logImpl: ke,
|
|
2039
2037
|
maxImpl: ns,
|
|
@@ -2046,20 +2044,20 @@ const Lo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2046
2044
|
raggedGatherImpl: ps,
|
|
2047
2045
|
raggedRangeImpl: ws,
|
|
2048
2046
|
raggedTensorToTensorImpl: Is,
|
|
2049
|
-
rangeImpl:
|
|
2047
|
+
rangeImpl: bs,
|
|
2050
2048
|
rsqrtImpl: Le,
|
|
2051
|
-
scatterImpl:
|
|
2052
|
-
sigmoidImpl:
|
|
2049
|
+
scatterImpl: Es,
|
|
2050
|
+
sigmoidImpl: Fs,
|
|
2053
2051
|
simpleAbsImpl: le,
|
|
2054
2052
|
sliceImpl: Pe,
|
|
2055
2053
|
sparseFillEmptyRowsImpl: Ns,
|
|
2056
2054
|
sparseReshapeImpl: vs,
|
|
2057
2055
|
sparseSegmentReductionImpl: Ss,
|
|
2058
2056
|
sqrtImpl: Ts,
|
|
2059
|
-
squaredDifferenceImpl:
|
|
2060
|
-
staticRegexReplaceImpl:
|
|
2057
|
+
squaredDifferenceImpl: qe,
|
|
2058
|
+
staticRegexReplaceImpl: Ae,
|
|
2061
2059
|
stridedSliceImpl: Ls,
|
|
2062
|
-
stringNGramsImpl:
|
|
2060
|
+
stringNGramsImpl: qs,
|
|
2063
2061
|
stringSplitImpl: _s,
|
|
2064
2062
|
stringToHashBucketFastImpl: Vs,
|
|
2065
2063
|
subImpl: _e,
|
|
@@ -2069,54 +2067,54 @@ const Lo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2069
2067
|
uniqueImpl: $s
|
|
2070
2068
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2071
2069
|
export {
|
|
2072
|
-
|
|
2070
|
+
ho as $,
|
|
2073
2071
|
ws as A,
|
|
2074
2072
|
Is as B,
|
|
2075
|
-
|
|
2076
|
-
|
|
2073
|
+
bs as C,
|
|
2074
|
+
Es as D,
|
|
2077
2075
|
Ns as E,
|
|
2078
2076
|
vs as F,
|
|
2079
2077
|
Ss as G,
|
|
2080
2078
|
Ls as H,
|
|
2081
|
-
|
|
2079
|
+
qs as I,
|
|
2082
2080
|
_s as J,
|
|
2083
2081
|
Vs as K,
|
|
2084
2082
|
Ws as L,
|
|
2085
2083
|
Us as M,
|
|
2086
2084
|
$s as N,
|
|
2087
2085
|
zn as O,
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2086
|
+
Js as P,
|
|
2087
|
+
no as Q,
|
|
2088
|
+
so as R,
|
|
2089
|
+
eo as S,
|
|
2090
|
+
oo as T,
|
|
2091
|
+
Qs as U,
|
|
2092
|
+
ro as V,
|
|
2093
|
+
ao as W,
|
|
2094
|
+
io as X,
|
|
2095
|
+
lo as Y,
|
|
2096
|
+
co as Z,
|
|
2097
|
+
uo as _,
|
|
2100
2098
|
nt as a,
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2099
|
+
Ys as a0,
|
|
2100
|
+
fo as a1,
|
|
2101
|
+
go as a2,
|
|
2102
|
+
mo as a3,
|
|
2103
|
+
po as a4,
|
|
2104
|
+
wo as a5,
|
|
2105
|
+
Io as a6,
|
|
2106
|
+
bo as a7,
|
|
2107
|
+
xo as a8,
|
|
2108
|
+
Fo as a9,
|
|
2109
|
+
to as aa,
|
|
2110
|
+
yo as ab,
|
|
2111
|
+
ko as ac,
|
|
2112
|
+
No as ad,
|
|
2113
|
+
vo as ae,
|
|
2114
|
+
So as af,
|
|
2115
|
+
To as ag,
|
|
2116
|
+
Ro as ah,
|
|
2117
|
+
Eo as ai,
|
|
2120
2118
|
ys as b,
|
|
2121
2119
|
U as c,
|
|
2122
2120
|
Vn as d,
|
|
@@ -2124,7 +2122,7 @@ export {
|
|
|
2124
2122
|
ks as f,
|
|
2125
2123
|
Cn as g,
|
|
2126
2124
|
mt as h,
|
|
2127
|
-
|
|
2125
|
+
Et as i,
|
|
2128
2126
|
$n as j,
|
|
2129
2127
|
Dn as k,
|
|
2130
2128
|
lt as l,
|
|
@@ -2134,12 +2132,12 @@ export {
|
|
|
2134
2132
|
Kn as p,
|
|
2135
2133
|
ts as q,
|
|
2136
2134
|
ce as r,
|
|
2137
|
-
|
|
2135
|
+
Mo as s,
|
|
2138
2136
|
Me as t,
|
|
2139
2137
|
de as u,
|
|
2140
2138
|
Re as v,
|
|
2141
2139
|
ns as w,
|
|
2142
2140
|
Bn as x,
|
|
2143
2141
|
ps as y,
|
|
2144
|
-
|
|
2142
|
+
xt as z
|
|
2145
2143
|
};
|