@genai-fi/nanogpt 0.8.0 → 0.8.2
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.d.ts +2 -1
- package/dist/Generator.js +44 -37
- package/dist/{RealDiv-N8TpOMYv.js → RealDiv-D_q39E3A.js} +14 -14
- package/dist/{Reshape-B-lWQRnF.js → Reshape-41YpQqEo.js} +1 -1
- package/dist/{Reshape-Bo8HzP8V.js → Reshape-Bh_jzKzV.js} +2 -2
- package/dist/TeachableLLM.js +7 -5
- package/dist/{axis_util-DubwyOhW.js → axis_util-Did9235A.js} +1 -1
- package/dist/backend.js +2 -2
- package/dist/{backend_util-BJ-_jSeK.js → backend_util-yC3YH1jo.js} +17 -17
- package/dist/{broadcast_to-BYfCp5iL.js → broadcast_to-CUvOdOT5.js} +2 -2
- package/dist/checks/appendCache.d.ts +1 -0
- package/dist/checks/appendCache.js +22 -0
- package/dist/checks/attentionMask.d.ts +1 -0
- package/dist/checks/attentionMask.js +37 -0
- package/dist/checks/check.d.ts +9 -0
- package/dist/checks/check.js +20 -0
- package/dist/checks/gelu.d.ts +1 -0
- package/dist/checks/gelu.js +18 -0
- package/dist/checks/index.d.ts +22 -0
- package/dist/checks/index.js +24 -0
- package/dist/checks/normRMS.d.ts +1 -0
- package/dist/checks/normRMS.js +16 -0
- package/dist/checks/normRMSGrad.d.ts +1 -0
- package/dist/checks/normRMSGrad.js +12 -0
- package/dist/checks/qkv.d.ts +1 -0
- package/dist/checks/qkv.js +50 -0
- package/dist/checks/rope.d.ts +1 -0
- package/dist/checks/rope.js +38 -0
- package/dist/checks/weights.d.ts +16 -0
- package/dist/checks/weights.js +29 -0
- package/dist/{concat-BmDqqFsa.js → concat-pHiVqR3L.js} +1 -1
- package/dist/{dataset-CJmEGu6D.js → dataset-DPPl-iLT.js} +7 -7
- package/dist/{dropout-sx0sjVAT.js → dropout-CcKSfOYE.js} +11 -11
- package/dist/{exports_initializers-DAKM8UO9.js → exports_initializers-DKk7-bsx.js} +1 -1
- package/dist/{gather-C1siEkdp.js → gather-CPg6ZlQA.js} +1 -1
- package/dist/{gelu-Bd3UBBxg.js → gelu-BkcmEEyD.js} +1 -1
- package/dist/{gpgpu_math-TFLxaLkw.js → gpgpu_math-D_ODOLix.js} +2 -2
- package/dist/{index-CUQrfsw_.js → index-DdmHGZjq.js} +655 -647
- package/dist/{index-BaPo_0H8.js → index-evZ57wr4.js} +10 -10
- package/dist/{kernel_funcs_utils-P9aFa232.js → kernel_funcs_utils-CDfFpUab.js} +15 -15
- package/dist/layers/BaseLayer.js +2 -2
- package/dist/layers/CausalSelfAttention.js +29 -29
- package/dist/layers/MLP.js +18 -18
- package/dist/layers/PositionEmbedding.js +5 -5
- package/dist/layers/RMSNorm.js +3 -3
- package/dist/layers/RoPECache.js +4 -4
- package/dist/layers/TiedEmbedding.js +11 -11
- package/dist/layers/TransformerBlock.js +1 -1
- package/dist/loader/loadTransformers.js +1 -1
- package/dist/loader/oldZipLoad.js +9 -7
- package/dist/{log_sum_exp-C142qZqY.js → log_sum_exp-C8yFJfZz.js} +45 -24
- package/dist/main.d.ts +2 -0
- package/dist/main.js +9 -7
- package/dist/{mat_mul-DMkduNJu.js → mat_mul-Dpy2mMRu.js} +1 -1
- package/dist/{mod-uUuj4gSb.js → mod-CbibJi3D.js} +1 -1
- package/dist/models/NanoGPTV1.js +1 -1
- package/dist/models/model.js +9 -7
- package/dist/{mulmat_packed_gpu-Cm2gw-c8.js → mulmat_packed_gpu-q_Gmwyld.js} +1 -1
- package/dist/{ones-ZdgQGBCP.js → ones-BAqVh-eA.js} +2 -2
- package/dist/ops/adamAdjust.js +1 -1
- package/dist/ops/adamMoments.js +1 -1
- package/dist/ops/appendCache.js +3 -3
- package/dist/ops/attentionMask.js +1 -1
- package/dist/ops/cpu/adamAdjust.js +1 -1
- package/dist/ops/cpu/adamMoments.js +2 -2
- package/dist/ops/cpu/appendCache.js +2 -2
- package/dist/ops/cpu/attentionMask.js +5 -5
- package/dist/ops/cpu/fusedSoftmax.js +2 -2
- package/dist/ops/cpu/gatherSub.js +5 -5
- package/dist/ops/cpu/gelu.js +1 -1
- package/dist/ops/cpu/matMulGelu.js +2 -2
- package/dist/ops/cpu/matMulMul.js +1 -1
- package/dist/ops/cpu/mulDropout.js +1 -1
- package/dist/ops/cpu/normRMS.js +1 -1
- package/dist/ops/cpu/qkv.js +3 -3
- package/dist/ops/cpu/rope.js +5 -5
- package/dist/ops/cpu/scatterSub.js +13 -13
- package/dist/ops/fusedSoftmax.js +1 -1
- package/dist/ops/gatherSub.js +1 -1
- package/dist/ops/gelu.js +2 -2
- package/dist/ops/grads/attentionMask.js +1 -1
- package/dist/ops/grads/fusedSoftmax.js +2 -2
- package/dist/ops/grads/gelu.js +2 -2
- package/dist/ops/grads/matMulGelu.js +1 -1
- package/dist/ops/grads/normRMS.js +1 -1
- package/dist/ops/grads/qkv.js +1 -1
- package/dist/ops/grads/rope.js +1 -1
- package/dist/ops/matMulGelu.js +1 -1
- package/dist/ops/matMulMul.js +1 -1
- package/dist/ops/mulDrop.js +1 -1
- package/dist/ops/normRMS.js +1 -1
- package/dist/ops/qkv.js +1 -1
- package/dist/ops/rope.js +4 -4
- package/dist/ops/scatterSub.js +1 -1
- package/dist/ops/webgl/adamAdjust.js +2 -2
- package/dist/ops/webgl/adamMoments.js +1 -1
- package/dist/ops/webgl/appendCache.js +1 -1
- package/dist/ops/webgl/attentionMask.js +1 -1
- package/dist/ops/webgl/fusedSoftmax.js +4 -4
- package/dist/ops/webgl/gatherSub.js +1 -1
- package/dist/ops/webgl/gelu.js +2 -2
- package/dist/ops/webgl/log.js +3 -3
- package/dist/ops/webgl/matMulGelu.js +4 -4
- package/dist/ops/webgl/matMulMul.js +1 -1
- package/dist/ops/webgl/mulDropout.js +1 -1
- package/dist/ops/webgl/normRMS.js +2 -2
- package/dist/ops/webgl/qkv.js +1 -1
- package/dist/ops/webgl/rope.js +1 -1
- package/dist/ops/webgl/scatterSub.js +1 -1
- package/dist/ops/webgpu/adamAdjust.js +3 -3
- package/dist/ops/webgpu/adamMoments.js +3 -3
- package/dist/ops/webgpu/appendCache.js +3 -3
- package/dist/ops/webgpu/attentionMask.js +3 -3
- package/dist/ops/webgpu/gatherSub.js +3 -3
- package/dist/ops/webgpu/gelu.js +3 -3
- package/dist/ops/webgpu/normRMS.js +2 -2
- package/dist/ops/webgpu/normRMSGrad.js +5 -5
- package/dist/ops/webgpu/qkv.js +3 -3
- package/dist/ops/webgpu/rope.js +3 -3
- package/dist/ops/webgpu/scatterSub.js +3 -3
- package/dist/ops/webgpu/utils/reductions.js +4 -4
- package/dist/ops-542ai2vG.js +1525 -0
- package/dist/{random_width-D8Pwy_na.js → random_width-DKGeiFuR.js} +1514 -1581
- package/dist/{range-LVHrSLdi.js → range-BcUvLuf5.js} +1 -1
- package/dist/{reciprocal-CaR9e67G.js → reciprocal-DhDWSKiD.js} +1 -1
- package/dist/{register_all_kernels-DUshvVWP.js → register_all_kernels-Do9VvZmo.js} +2312 -2335
- package/dist/{max-B3JOcNGb.js → relu-B1AXs7p5.js} +6 -6
- package/dist/{reshape-DEfQGSin.js → reshape-WeJkT3ja.js} +1 -1
- package/dist/{scatter_nd_util-CUPPNLaA.js → scatter_nd_util-B7yDhiQr.js} +1 -1
- package/dist/{selu_util-8vv5JxQV.js → selu_util-BgUO9gHY.js} +125 -146
- package/dist/{shared-D1elLckx.js → shared-CZiWmQCI.js} +1 -1
- package/dist/{shared-CkNorDcU.js → shared-V6D_md-c.js} +120 -120
- package/dist/{sin-D2CKKmyR.js → sin-CPxad7Am.js} +1 -1
- package/dist/{slice-BnyE-M_7.js → slice-B7jXtPnp.js} +1 -1
- package/dist/{softmax-DLoZWYBx.js → softmax-BfsyI4As.js} +1 -1
- package/dist/{split-By_n4TKP.js → split-BPxr8_8m.js} +1 -1
- package/dist/{stack-DkdFLq37.js → stack-BNwLzE43.js} +1 -1
- package/dist/{sum-l_0SqM4h.js → sum-ByFINZgi.js} +1 -1
- package/dist/{tensor-BAQdLqoU.js → tensor-DbqgIV9B.js} +1 -1
- package/dist/tensor1d-CtJq5BOv.js +27 -0
- package/dist/{tensor2d-BHy261cI.js → tensor2d-CObBWBkW.js} +1 -1
- package/dist/tensor4d-DLtk7Nxh.js +30 -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 +8 -9
- package/dist/utilities/arrayClose.d.ts +1 -1
- package/dist/utilities/arrayClose.js +16 -7
- package/dist/utilities/dummy.js +2 -2
- package/dist/utilities/multinomialCPU.js +2 -2
- package/dist/utilities/performance.js +1 -1
- package/dist/utilities/profile.js +1 -1
- package/dist/utilities/safetensors.js +2 -2
- package/dist/utilities/weights.js +2 -2
- package/dist/{variable-C9hihzDB.js → variable-DPFOJyRG.js} +1 -1
- package/dist/{webgpu_program-dFEVbDPL.js → webgpu_program-Dhk9R5aG.js} +1 -1
- package/dist/{webgpu_util-DLImlSc6.js → webgpu_util-BqGnZg8t.js} +1 -1
- package/dist/{zeros-VZ72lWXM.js → zeros-Dnwix0p4.js} +1 -1
- package/package.json +1 -1
- package/dist/ops-C_1K_-35.js +0 -1202
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { n as Lt,
|
|
2
|
-
import { f as it, m as kt, g as
|
|
3
|
-
import { g as pn, a as wn, e as In, c as bn } from "./axis_util-
|
|
4
|
-
import { b as xn } from "./broadcast_to-
|
|
5
|
-
import { r as En } from "./reshape-
|
|
6
|
-
import { p as Fn, q as yn, r as kn, u as Nn } from "./selu_util-
|
|
1
|
+
import { n as Lt, bm as Ce, j as V, l as Pt, a3 as K, bn as et, ae as ht, bo as dt, bp as at, aa as De, ab as st, az as We, b8 as $e, bq as Ue, br as ze, bs as Be, bt as At, ap as H, bu as qt, bv as W, bw as _t, bx as Vt, ai as Ct, by as Dt, ao as Wt, bz as $t, aZ as Ut, a_ as zt, b0 as Bt, b1 as jt, aj as Gt, bA as Zt, b6 as Ht, bB as Kt, b3 as je, aA as Ge, b7 as Xt, bc as Ze, bC as He, p as Jt, u as Ke, t as Xe, bD as Qt, bE as It, ar as Yt, $ as Je, bF as te, ba as ee, bG as ne, aP as pt, bH as se, bI as ot } from "./index-DdmHGZjq.js";
|
|
2
|
+
import { f as it, m as kt, 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, n as un, o as hn, p as fn, q as Nt, r as dn, s as gn, t as mn } from "./backend_util-yC3YH1jo.js";
|
|
3
|
+
import { g as pn, a as wn, e as In, c as bn } from "./axis_util-Did9235A.js";
|
|
4
|
+
import { b as xn } from "./broadcast_to-CUvOdOT5.js";
|
|
5
|
+
import { r as En } from "./reshape-WeJkT3ja.js";
|
|
6
|
+
import { p as Fn, q as yn, r as kn, u as Nn } from "./selu_util-BgUO9gHY.js";
|
|
7
7
|
import { g as vn } from "./_commonjsHelpers-ByX85dGu.js";
|
|
8
8
|
function Sn(e, t) {
|
|
9
9
|
for (var n = 0; n < t.length; n++) {
|
|
@@ -365,8 +365,8 @@ function Tn() {
|
|
|
365
365
|
throw Error("interior hyphen");
|
|
366
366
|
if (N === 0)
|
|
367
367
|
return u(I.substring(1), c, E).neg();
|
|
368
|
-
for (var L = r(l(E, 8)), R = g,
|
|
369
|
-
var U = Math.min(8, I.length -
|
|
368
|
+
for (var L = r(l(E, 8)), R = g, A = 0; A < I.length; A += 8) {
|
|
369
|
+
var U = Math.min(8, I.length - A), j = parseInt(I.substring(A, A + U), E);
|
|
370
370
|
if (U < 8) {
|
|
371
371
|
var C = r(l(E, U));
|
|
372
372
|
R = R.mul(C).add(r(j));
|
|
@@ -412,13 +412,13 @@ function Tn() {
|
|
|
412
412
|
return N.toString(c) + L.toInt().toString(c);
|
|
413
413
|
} else
|
|
414
414
|
return "-" + this.neg().toString(c);
|
|
415
|
-
for (var R = r(l(c, 6), this.unsigned),
|
|
416
|
-
var j =
|
|
417
|
-
if (
|
|
418
|
-
return
|
|
419
|
-
for (;
|
|
420
|
-
|
|
421
|
-
U = "" +
|
|
415
|
+
for (var R = r(l(c, 6), this.unsigned), A = this, U = ""; ; ) {
|
|
416
|
+
var j = A.div(R), C = A.sub(j.mul(R)).toInt() >>> 0, P = C.toString(c);
|
|
417
|
+
if (A = j, A.isZero())
|
|
418
|
+
return P + U;
|
|
419
|
+
for (; P.length < 6; )
|
|
420
|
+
P = "0" + P;
|
|
421
|
+
U = "" + P + U;
|
|
422
422
|
}
|
|
423
423
|
}, x.getHighBits = function() {
|
|
424
424
|
return this.high;
|
|
@@ -480,8 +480,8 @@ function Tn() {
|
|
|
480
480
|
return !this.unsigned && this.eq(S) ? S : this.not().add(k);
|
|
481
481
|
}, x.neg = x.negate, x.add = function(c) {
|
|
482
482
|
n(c) || (c = h(c));
|
|
483
|
-
var E = this.high >>> 16, N = this.high & 65535, L = this.low >>> 16, R = this.low & 65535,
|
|
484
|
-
return B += R + C, _ += B >>> 16, B &= 65535, _ += L + j, G += _ >>> 16, _ &= 65535, G += N + U,
|
|
483
|
+
var E = this.high >>> 16, N = this.high & 65535, L = this.low >>> 16, R = this.low & 65535, A = c.high >>> 16, U = c.high & 65535, j = c.low >>> 16, C = c.low & 65535, P = 0, G = 0, _ = 0, B = 0;
|
|
484
|
+
return B += R + C, _ += B >>> 16, B &= 65535, _ += L + j, G += _ >>> 16, _ &= 65535, G += N + U, P += G >>> 16, G &= 65535, P += E + A, P &= 65535, i(_ << 16 | B, P << 16 | G, this.unsigned);
|
|
485
485
|
}, x.subtract = function(c) {
|
|
486
486
|
return n(c) || (c = h(c)), this.add(c.neg());
|
|
487
487
|
}, x.sub = x.subtract, x.multiply = function(c) {
|
|
@@ -508,8 +508,8 @@ function Tn() {
|
|
|
508
508
|
return this.mul(c.neg()).neg();
|
|
509
509
|
if (this.lt(d) && c.lt(d))
|
|
510
510
|
return r(this.toNumber() * c.toNumber(), this.unsigned);
|
|
511
|
-
var N = this.high >>> 16, L = this.high & 65535, R = this.low >>> 16,
|
|
512
|
-
return ct +=
|
|
511
|
+
var N = this.high >>> 16, L = this.high & 65535, R = this.low >>> 16, A = this.low & 65535, U = c.high >>> 16, j = c.high & 65535, C = c.low >>> 16, P = c.low & 65535, G = 0, _ = 0, B = 0, ct = 0;
|
|
512
|
+
return ct += A * P, B += ct >>> 16, ct &= 65535, B += R * P, _ += B >>> 16, B &= 65535, B += A * C, _ += B >>> 16, B &= 65535, _ += L * P, G += _ >>> 16, _ &= 65535, _ += R * C, G += _ >>> 16, _ &= 65535, _ += A * j, G += _ >>> 16, _ &= 65535, G += N * P + L * C + R * j + A * U, G &= 65535, i(B << 16 | ct, G << 16 | _, this.unsigned);
|
|
513
513
|
}, x.mul = x.multiply, x.divide = function(c) {
|
|
514
514
|
if (n(c) || (c = h(c)), c.isZero())
|
|
515
515
|
throw Error("division by zero");
|
|
@@ -539,8 +539,8 @@ function Tn() {
|
|
|
539
539
|
return S;
|
|
540
540
|
if (c.eq(S))
|
|
541
541
|
return k;
|
|
542
|
-
var
|
|
543
|
-
return N =
|
|
542
|
+
var A = this.shr(1);
|
|
543
|
+
return N = A.div(c).shl(1), N.eq(g) ? c.isNegative() ? k : v : (L = this.sub(c.mul(N)), R = N.add(L.div(c)), R);
|
|
544
544
|
} else if (c.eq(S))
|
|
545
545
|
return this.unsigned ? b : g;
|
|
546
546
|
if (this.isNegative())
|
|
@@ -551,9 +551,9 @@ function Tn() {
|
|
|
551
551
|
}
|
|
552
552
|
for (L = this; L.gte(c); ) {
|
|
553
553
|
N = Math.max(1, Math.floor(L.toNumber() / c.toNumber()));
|
|
554
|
-
for (var U = Math.ceil(Math.log(N) / Math.LN2), j = U <= 48 ? 1 : l(2, U - 48), C = r(N),
|
|
555
|
-
N -= j, C = r(N, this.unsigned),
|
|
556
|
-
C.isZero() && (C = k), R = R.add(C), L = L.sub(
|
|
554
|
+
for (var U = Math.ceil(Math.log(N) / Math.LN2), j = U <= 48 ? 1 : l(2, U - 48), C = r(N), P = C.mul(c); P.isNegative() || P.gt(L); )
|
|
555
|
+
N -= j, C = r(N, this.unsigned), P = C.mul(c);
|
|
556
|
+
C.isZero() && (C = k), R = R.add(C), L = L.sub(P);
|
|
557
557
|
}
|
|
558
558
|
return R;
|
|
559
559
|
}, x.div = x.divide, x.modulo = function(c) {
|
|
@@ -661,7 +661,7 @@ const tt = (
|
|
|
661
661
|
function gt(e) {
|
|
662
662
|
return tt.fromString(e, !0, 16);
|
|
663
663
|
}
|
|
664
|
-
const ae = gt("c3a5c85c97cb3127"),
|
|
664
|
+
const ae = gt("c3a5c85c97cb3127"), Y = gt("b492b66fbe98f273"), D = gt("9ae16a3b2f90404f");
|
|
665
665
|
function bt(e) {
|
|
666
666
|
return e.xor(e.shru(47));
|
|
667
667
|
}
|
|
@@ -675,31 +675,31 @@ function T(e, t) {
|
|
|
675
675
|
function St(e, t) {
|
|
676
676
|
return ie(e, t, 4);
|
|
677
677
|
}
|
|
678
|
-
function
|
|
678
|
+
function q(e, t) {
|
|
679
679
|
return t === 0 ? e : e.shru(t).or(e.shl(64 - t));
|
|
680
680
|
}
|
|
681
|
-
function
|
|
681
|
+
function J(e, t, n = gt("9ddfea08eb382d69")) {
|
|
682
682
|
let s = e.xor(t).mul(n);
|
|
683
683
|
s = s.xor(s.shru(47));
|
|
684
684
|
let o = t.xor(s).mul(n);
|
|
685
685
|
return o = o.xor(o.shru(47)), o = o.mul(n), o;
|
|
686
686
|
}
|
|
687
687
|
function Mn(e, t, n, s, o, a) {
|
|
688
|
-
o = o.add(e), a =
|
|
688
|
+
o = o.add(e), a = q(a.add(o).add(s), 21);
|
|
689
689
|
const r = o;
|
|
690
|
-
return o = o.add(t), o = o.add(n), a = a.add(
|
|
690
|
+
return o = o.add(t), o = o.add(n), a = a.add(q(o, 44)), [o.add(s), a.add(r)];
|
|
691
691
|
}
|
|
692
692
|
function ut(e, t, n, s) {
|
|
693
693
|
return Mn(T(e, t), T(e, t + 8), T(e, t + 16), T(e, t + 24), n, s);
|
|
694
694
|
}
|
|
695
695
|
function On(e, t = e.length) {
|
|
696
696
|
if (t >= 8) {
|
|
697
|
-
const n = D.add(t * 2), s = T(e, 0).add(D), o = T(e, t - 8), a =
|
|
698
|
-
return
|
|
697
|
+
const n = D.add(t * 2), s = T(e, 0).add(D), o = T(e, t - 8), a = q(o, 37).mul(n).add(s), r = q(s, 25).add(o).mul(n);
|
|
698
|
+
return J(a, r, n);
|
|
699
699
|
}
|
|
700
700
|
if (t >= 4) {
|
|
701
701
|
const n = D.add(t * 2), s = St(e, 0);
|
|
702
|
-
return
|
|
702
|
+
return J(s.shl(3).add(t), St(e, t - 4), n);
|
|
703
703
|
}
|
|
704
704
|
if (t > 0) {
|
|
705
705
|
const n = e[0], s = e[t >> 1], o = e[t - 1], a = n + (s << 8), r = t + (o << 2);
|
|
@@ -708,28 +708,28 @@ function On(e, t = e.length) {
|
|
|
708
708
|
return D;
|
|
709
709
|
}
|
|
710
710
|
function Ln(e, t = e.length) {
|
|
711
|
-
const n = D.add(t * 2), s = T(e, 0).mul(
|
|
712
|
-
return
|
|
713
|
-
}
|
|
714
|
-
function qn(e, t = e.length) {
|
|
715
|
-
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 = Y(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);
|
|
716
|
-
return Y(A(u.add(h), 43).add(A(f, 30)).add(p), u.add(A(h.add(s), 18)).add(f), n);
|
|
711
|
+
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);
|
|
712
|
+
return J(q(s.add(o), 43).add(q(a, 30)).add(r), s.add(q(o.add(D), 18)).add(a), n);
|
|
717
713
|
}
|
|
718
714
|
function Pn(e, t = e.length) {
|
|
715
|
+
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 = q(s.add(o), 43).add(q(a, 30)).add(r), l = J(i, s.add(q(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);
|
|
716
|
+
return J(q(u.add(h), 43).add(q(f, 30)).add(p), u.add(q(h.add(s), 18)).add(f), n);
|
|
717
|
+
}
|
|
718
|
+
function An(e, t = e.length) {
|
|
719
719
|
const n = tt.fromNumber(81, !0);
|
|
720
720
|
if (t <= 32)
|
|
721
721
|
return t <= 16 ? On(e, t) : Ln(e, t);
|
|
722
722
|
if (t <= 64)
|
|
723
|
-
return
|
|
724
|
-
let s = n, o = n.mul(
|
|
723
|
+
return Pn(e, t);
|
|
724
|
+
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];
|
|
725
725
|
s = s.mul(D).add(T(e, 0));
|
|
726
726
|
let l = 0;
|
|
727
727
|
const u = (t - 1 >> 6) * 64, h = u + (t - 1 & 63) - 63;
|
|
728
728
|
do
|
|
729
|
-
s =
|
|
729
|
+
s = q(s.add(o).add(r[0]).add(T(e, l + 8)), 37).mul(Y), o = q(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 = q(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;
|
|
730
730
|
while (l !== u);
|
|
731
|
-
const f =
|
|
732
|
-
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 =
|
|
731
|
+
const f = Y.add(a.and(255).shl(1));
|
|
732
|
+
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 = q(s.add(o).add(r[0]).add(T(e, l + 8)), 37).mul(f), o = q(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 = q(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);
|
|
733
733
|
}
|
|
734
734
|
/**
|
|
735
735
|
* @license
|
|
@@ -774,7 +774,7 @@ function le(e) {
|
|
|
774
774
|
t[n] = Math.abs(e[n]);
|
|
775
775
|
return t;
|
|
776
776
|
}
|
|
777
|
-
const
|
|
777
|
+
const qn = (e) => {
|
|
778
778
|
const { x: t } = e.inputs, n = e.backend;
|
|
779
779
|
nt(t, "abs");
|
|
780
780
|
let s = new Float32Array(V(t.shape));
|
|
@@ -783,7 +783,7 @@ const An = (e) => {
|
|
|
783
783
|
}, Xs = {
|
|
784
784
|
kernelName: Ce,
|
|
785
785
|
backendName: "cpu",
|
|
786
|
-
kernelFunc:
|
|
786
|
+
kernelFunc: qn
|
|
787
787
|
};
|
|
788
788
|
/**
|
|
789
789
|
* @license
|
|
@@ -803,7 +803,7 @@ const An = (e) => {
|
|
|
803
803
|
*/
|
|
804
804
|
function $(e) {
|
|
805
805
|
return (t, n, s, o, a) => {
|
|
806
|
-
const r =
|
|
806
|
+
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);
|
|
807
807
|
if (F.length + d.length === 0)
|
|
808
808
|
for (let g = 0; g < h.length; ++g)
|
|
809
809
|
h[g] = e(s[g % s.length], o[g % o.length]);
|
|
@@ -842,7 +842,7 @@ function mt(e) {
|
|
|
842
842
|
imag: n.makeTensorInfo(o.shape, "float32", r)
|
|
843
843
|
}, i;
|
|
844
844
|
}
|
|
845
|
-
const
|
|
845
|
+
const Js = {
|
|
846
846
|
kernelName: De,
|
|
847
847
|
backendName: "cpu",
|
|
848
848
|
kernelFunc: mt
|
|
@@ -891,7 +891,7 @@ function Et(e) {
|
|
|
891
891
|
const { inputs: t, backend: n } = e, { x: s } = t;
|
|
892
892
|
return n.incRef(s.dataId), { dataId: s.dataId, shape: s.shape, dtype: s.dtype };
|
|
893
893
|
}
|
|
894
|
-
const
|
|
894
|
+
const Qs = {
|
|
895
895
|
kernelName: We,
|
|
896
896
|
backendName: "cpu",
|
|
897
897
|
kernelFunc: Et
|
|
@@ -916,7 +916,7 @@ function ce(e) {
|
|
|
916
916
|
const { inputs: t, backend: n } = e, { input: s } = t, o = n.data.get(s.dataId).complexTensorInfos.real, a = n.data.get(o.dataId).values;
|
|
917
917
|
return n.makeTensorInfo(o.shape, o.dtype, a);
|
|
918
918
|
}
|
|
919
|
-
const
|
|
919
|
+
const Ys = {
|
|
920
920
|
kernelName: $e,
|
|
921
921
|
backendName: "cpu",
|
|
922
922
|
kernelFunc: ce
|
|
@@ -1013,7 +1013,7 @@ function z(e, t, n, s) {
|
|
|
1013
1013
|
}
|
|
1014
1014
|
function Ft(e) {
|
|
1015
1015
|
return (t, n, s, o, a, r) => {
|
|
1016
|
-
const i =
|
|
1016
|
+
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 = kt(s, o), d = kt(a, r), g = t.length, b = K(t), k = n.length, y = K(n);
|
|
1017
1017
|
if (w.length + m.length === 0)
|
|
1018
1018
|
for (let v = 0; v < f.length; v++) {
|
|
1019
1019
|
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]);
|
|
@@ -1047,8 +1047,8 @@ function Ft(e) {
|
|
|
1047
1047
|
* limitations under the License.
|
|
1048
1048
|
* =============================================================================
|
|
1049
1049
|
*/
|
|
1050
|
-
const he = $((e, t) => e + t), _n = Ft((e, t, n, s) => ({ real: e + n, imag: t + s })), Vn = z(
|
|
1051
|
-
kernelName:
|
|
1050
|
+
const he = $((e, t) => e + t), _n = Ft((e, t, n, s) => ({ real: e + n, imag: t + s })), Vn = z(At, he, _n), eo = {
|
|
1051
|
+
kernelName: At,
|
|
1052
1052
|
backendName: "cpu",
|
|
1053
1053
|
kernelFunc: Vn
|
|
1054
1054
|
};
|
|
@@ -1079,7 +1079,7 @@ function Cn(e, t, n, s, o) {
|
|
|
1079
1079
|
return r;
|
|
1080
1080
|
}
|
|
1081
1081
|
function Dn(e, t, n, s = !1) {
|
|
1082
|
-
const o = e.shape[0], a = e.shape[1], r =
|
|
1082
|
+
const o = e.shape[0], a = e.shape[1], r = H([o, n], t.dtype);
|
|
1083
1083
|
for (let i = 0; i < o; i++)
|
|
1084
1084
|
for (let l = 0; l < a; l++) {
|
|
1085
1085
|
const u = e.get(i, l);
|
|
@@ -1105,8 +1105,8 @@ function Dn(e, t, n, s = !1) {
|
|
|
1105
1105
|
* limitations under the License.
|
|
1106
1106
|
* =============================================================================
|
|
1107
1107
|
*/
|
|
1108
|
-
const fe = $((e, t) => e & t), Wn = z(
|
|
1109
|
-
kernelName:
|
|
1108
|
+
const fe = $((e, t) => e & t), Wn = z(qt, fe), no = {
|
|
1109
|
+
kernelName: qt,
|
|
1110
1110
|
backendName: "cpu",
|
|
1111
1111
|
kernelFunc: Wn
|
|
1112
1112
|
};
|
|
@@ -1152,9 +1152,9 @@ function X(e) {
|
|
|
1152
1152
|
*/
|
|
1153
1153
|
function de(e, t, n) {
|
|
1154
1154
|
const s = X(t);
|
|
1155
|
-
return
|
|
1155
|
+
return Q(e, s, n);
|
|
1156
1156
|
}
|
|
1157
|
-
function
|
|
1157
|
+
function Q(e, t, n) {
|
|
1158
1158
|
return ({ inputs: s, attrs: o, backend: a }) => {
|
|
1159
1159
|
const { x: r } = s;
|
|
1160
1160
|
nt(r, e);
|
|
@@ -1186,7 +1186,7 @@ function J(e, t, n) {
|
|
|
1186
1186
|
* limitations under the License.
|
|
1187
1187
|
* =============================================================================
|
|
1188
1188
|
*/
|
|
1189
|
-
const ge = X((e) => Math.ceil(e)), $n =
|
|
1189
|
+
const ge = X((e) => Math.ceil(e)), $n = Q(_t, ge), so = {
|
|
1190
1190
|
kernelName: _t,
|
|
1191
1191
|
backendName: "cpu",
|
|
1192
1192
|
kernelFunc: $n
|
|
@@ -1267,7 +1267,7 @@ const me = $((e, t) => e === t ? 1 : 0), zn = z(Vt, me, null, "bool"), oo = {
|
|
|
1267
1267
|
* limitations under the License.
|
|
1268
1268
|
* =============================================================================
|
|
1269
1269
|
*/
|
|
1270
|
-
const pe = X((e) => Math.exp(e)), Bn =
|
|
1270
|
+
const pe = X((e) => Math.exp(e)), Bn = Q(Ct, pe, "float32"), ro = {
|
|
1271
1271
|
kernelName: Ct,
|
|
1272
1272
|
backendName: "cpu",
|
|
1273
1273
|
kernelFunc: Bn
|
|
@@ -1288,7 +1288,7 @@ const pe = X((e) => Math.exp(e)), Bn = J(Ct, pe, "float32"), ro = {
|
|
|
1288
1288
|
* limitations under the License.
|
|
1289
1289
|
* =============================================================================
|
|
1290
1290
|
*/
|
|
1291
|
-
const we = X((e) => Math.expm1(e)), jn =
|
|
1291
|
+
const we = X((e) => Math.expm1(e)), jn = Q(Dt, we), ao = {
|
|
1292
1292
|
kernelName: Dt,
|
|
1293
1293
|
backendName: "cpu",
|
|
1294
1294
|
kernelFunc: jn
|
|
@@ -1309,7 +1309,7 @@ const we = X((e) => Math.expm1(e)), jn = J(Dt, we), ao = {
|
|
|
1309
1309
|
* limitations under the License.
|
|
1310
1310
|
* =============================================================================
|
|
1311
1311
|
*/
|
|
1312
|
-
const Ie = X((e) => Math.floor(e)), Gn =
|
|
1312
|
+
const Ie = X((e) => Math.floor(e)), Gn = Q(Wt, Ie), io = {
|
|
1313
1313
|
kernelName: Wt,
|
|
1314
1314
|
backendName: "cpu",
|
|
1315
1315
|
kernelFunc: Gn
|
|
@@ -1351,8 +1351,8 @@ const be = $((e, t) => Math.floor(e / t)), Zn = z($t, be, null, "int32"), lo = {
|
|
|
1351
1351
|
* limitations under the License.
|
|
1352
1352
|
* =============================================================================
|
|
1353
1353
|
*/
|
|
1354
|
-
function
|
|
1355
|
-
const u =
|
|
1354
|
+
function Hn(e, t, n, s, o, a, r, i, l) {
|
|
1355
|
+
const u = H([s, a], n);
|
|
1356
1356
|
for (let h = 0; h < s; h++) {
|
|
1357
1357
|
const f = [];
|
|
1358
1358
|
let p = 0;
|
|
@@ -1383,8 +1383,8 @@ function Kn(e, t, n, s, o, a, r, i, l) {
|
|
|
1383
1383
|
* limitations under the License.
|
|
1384
1384
|
* =============================================================================
|
|
1385
1385
|
*/
|
|
1386
|
-
function
|
|
1387
|
-
const s =
|
|
1386
|
+
function Kn(e, t, n) {
|
|
1387
|
+
const s = H(n, e.dtype);
|
|
1388
1388
|
for (let o = 0; o < s.size; ++o) {
|
|
1389
1389
|
const r = s.indexToLoc(o).slice(), i = r[0], l = r[2], u = t.locToIndex([i, l]);
|
|
1390
1390
|
r[2] = t.values[u];
|
|
@@ -1430,10 +1430,10 @@ const xe = $((e, t) => e > t ? 1 : 0), Xn = z(Ut, xe, null, "bool"), co = {
|
|
|
1430
1430
|
* limitations under the License.
|
|
1431
1431
|
* =============================================================================
|
|
1432
1432
|
*/
|
|
1433
|
-
const Ee = $((e, t) => e >= t ? 1 : 0),
|
|
1433
|
+
const Ee = $((e, t) => e >= t ? 1 : 0), Jn = z(zt, Ee, null, "bool"), uo = {
|
|
1434
1434
|
kernelName: zt,
|
|
1435
1435
|
backendName: "cpu",
|
|
1436
|
-
kernelFunc:
|
|
1436
|
+
kernelFunc: Jn
|
|
1437
1437
|
};
|
|
1438
1438
|
/**
|
|
1439
1439
|
* @license
|
|
@@ -1451,10 +1451,10 @@ const Ee = $((e, t) => e >= t ? 1 : 0), Yn = z(zt, Ee, null, "bool"), uo = {
|
|
|
1451
1451
|
* limitations under the License.
|
|
1452
1452
|
* =============================================================================
|
|
1453
1453
|
*/
|
|
1454
|
-
const Fe = $((e, t) => e < t ? 1 : 0),
|
|
1454
|
+
const Fe = $((e, t) => e < t ? 1 : 0), Qn = z(Bt, Fe, null, "bool"), ho = {
|
|
1455
1455
|
kernelName: Bt,
|
|
1456
1456
|
backendName: "cpu",
|
|
1457
|
-
kernelFunc:
|
|
1457
|
+
kernelFunc: Qn
|
|
1458
1458
|
};
|
|
1459
1459
|
/**
|
|
1460
1460
|
* @license
|
|
@@ -1472,10 +1472,10 @@ const Fe = $((e, t) => e < t ? 1 : 0), Jn = z(Bt, Fe, null, "bool"), ho = {
|
|
|
1472
1472
|
* limitations under the License.
|
|
1473
1473
|
* =============================================================================
|
|
1474
1474
|
*/
|
|
1475
|
-
const ye = $((e, t) => e <= t ? 1 : 0),
|
|
1475
|
+
const ye = $((e, t) => e <= t ? 1 : 0), Yn = z(jt, ye, null, "bool"), fo = {
|
|
1476
1476
|
kernelName: jt,
|
|
1477
1477
|
backendName: "cpu",
|
|
1478
|
-
kernelFunc:
|
|
1478
|
+
kernelFunc: Yn
|
|
1479
1479
|
};
|
|
1480
1480
|
/**
|
|
1481
1481
|
* @license
|
|
@@ -1516,7 +1516,7 @@ function ts(e, t, n) {
|
|
|
1516
1516
|
* limitations under the License.
|
|
1517
1517
|
* =============================================================================
|
|
1518
1518
|
*/
|
|
1519
|
-
const ke = X((e) => Math.log(e)), es =
|
|
1519
|
+
const ke = X((e) => Math.log(e)), es = Q(Gt, ke), go = {
|
|
1520
1520
|
kernelName: Gt,
|
|
1521
1521
|
backendName: "cpu",
|
|
1522
1522
|
kernelFunc: es
|
|
@@ -1587,8 +1587,8 @@ const Ne = $((e, t) => Math.max(e, t)), ss = z(Zt, Ne), mo = {
|
|
|
1587
1587
|
* limitations under the License.
|
|
1588
1588
|
* =============================================================================
|
|
1589
1589
|
*/
|
|
1590
|
-
const ve = $((e, t) => Math.min(e, t)), os = z(
|
|
1591
|
-
kernelName:
|
|
1590
|
+
const ve = $((e, t) => Math.min(e, t)), os = z(Ht, ve), po = {
|
|
1591
|
+
kernelName: Ht,
|
|
1592
1592
|
backendName: "cpu",
|
|
1593
1593
|
kernelFunc: os
|
|
1594
1594
|
};
|
|
@@ -1611,8 +1611,8 @@ const ve = $((e, t) => Math.min(e, t)), os = z(Kt, ve), po = {
|
|
|
1611
1611
|
const yt = $((e, t) => e * t), rs = Ft((e, t, n, s) => ({
|
|
1612
1612
|
real: e * n - t * s,
|
|
1613
1613
|
imag: e * s + t * n
|
|
1614
|
-
})), as = z(
|
|
1615
|
-
kernelName:
|
|
1614
|
+
})), as = z(Kt, yt, rs), wo = {
|
|
1615
|
+
kernelName: Kt,
|
|
1616
1616
|
backendName: "cpu",
|
|
1617
1617
|
kernelFunc: as
|
|
1618
1618
|
};
|
|
@@ -1685,7 +1685,7 @@ const Te = $((e, t) => e !== t ? 1 : 0), ls = z(Xt, Te, null, "bool"), bo = {
|
|
|
1685
1685
|
* =============================================================================
|
|
1686
1686
|
*/
|
|
1687
1687
|
function Re(e, t, n, s, o) {
|
|
1688
|
-
const a = t.length, r = V(t), i =
|
|
1688
|
+
const a = t.length, r = V(t), i = K(t), l = K(o), u = et(n, V(o));
|
|
1689
1689
|
for (let h = 0; h < r; ++h) {
|
|
1690
1690
|
const f = dt(h, a, i), p = new Array(f.length);
|
|
1691
1691
|
for (let m = 0; m < p.length; m++)
|
|
@@ -1742,7 +1742,7 @@ const xo = {
|
|
|
1742
1742
|
* =============================================================================
|
|
1743
1743
|
*/
|
|
1744
1744
|
function Oe(e, t, n, s) {
|
|
1745
|
-
const [o, a] = bn(e, s), r =
|
|
1745
|
+
const [o, a] = bn(e, s), r = Ke(t, "int32"), i = st(V(o), r), l = V(a);
|
|
1746
1746
|
for (let u = 0; u < i.length; ++u) {
|
|
1747
1747
|
const h = u * l;
|
|
1748
1748
|
let f = 1;
|
|
@@ -1755,7 +1755,7 @@ function Oe(e, t, n, s) {
|
|
|
1755
1755
|
function cs(e) {
|
|
1756
1756
|
const { inputs: t, backend: n, attrs: s } = e, { x: o } = t, { axis: a, keepDims: r } = s;
|
|
1757
1757
|
nt(o, "prod");
|
|
1758
|
-
const i = o.shape.length, l =
|
|
1758
|
+
const i = o.shape.length, l = Jt(a, o.shape), u = pn(l, i);
|
|
1759
1759
|
let h = l, f = o;
|
|
1760
1760
|
const p = [];
|
|
1761
1761
|
u != null && (f = Me({ inputs: { x: o }, backend: n, attrs: { perm: u } }), p.push(f), h = wn(h.length, i));
|
|
@@ -1764,7 +1764,7 @@ function cs(e) {
|
|
|
1764
1764
|
return r && (g = In(F, l)), p.forEach((b) => n.disposeIntermediateTensorInfo(b)), n.makeTensorInfo(g, d, m);
|
|
1765
1765
|
}
|
|
1766
1766
|
const Eo = {
|
|
1767
|
-
kernelName:
|
|
1767
|
+
kernelName: He,
|
|
1768
1768
|
backendName: "cpu",
|
|
1769
1769
|
kernelFunc: cs
|
|
1770
1770
|
};
|
|
@@ -1787,7 +1787,7 @@ const Eo = {
|
|
|
1787
1787
|
function us(e, t, n) {
|
|
1788
1788
|
e.forEach((s, o) => {
|
|
1789
1789
|
if (s < 0 || s >= n) {
|
|
1790
|
-
const a = dt(o, t.length,
|
|
1790
|
+
const a = dt(o, t.length, K(t)).join(",");
|
|
1791
1791
|
throw new Error(`indices[${a}] = ${s} is not in [0, ${n})`);
|
|
1792
1792
|
}
|
|
1793
1793
|
});
|
|
@@ -1948,7 +1948,7 @@ function ws(e, t, n, s, o, a, r) {
|
|
|
1948
1948
|
var Z = tn;
|
|
1949
1949
|
class ft {
|
|
1950
1950
|
constructor(t, n, s, o, a, r, i, l, u, h) {
|
|
1951
|
-
this.shape = t, this.shapeShape = n, this.values = s, this.valuesShape = o, this.valuesDType = a, this.defaultValue = r, this.defaultValueShape = i, this.rowPartitionValues = l, this.rowPartitionValuesShapes = u, this.rowPartitionTypes =
|
|
1951
|
+
this.shape = t, this.shapeShape = n, this.values = s, this.valuesShape = o, this.valuesDType = a, this.defaultValue = r, this.defaultValueShape = i, this.rowPartitionValues = l, this.rowPartitionValuesShapes = u, this.rowPartitionTypes = Qe(h), this.raggedRank = Ye(this.rowPartitionTypes);
|
|
1952
1952
|
}
|
|
1953
1953
|
getRowPartitionTypeByDimension(t) {
|
|
1954
1954
|
return this.rowPartitionTypes[0] === Z.FIRST_DIM_SIZE ? this.rowPartitionTypes[t + 1] : this.rowPartitionTypes[t];
|
|
@@ -2236,8 +2236,8 @@ function bs(e, t, n, s) {
|
|
|
2236
2236
|
* limitations under the License.
|
|
2237
2237
|
* =============================================================================
|
|
2238
2238
|
*/
|
|
2239
|
-
const Le = X((e) => 1 / Math.sqrt(e)), xs =
|
|
2240
|
-
kernelName:
|
|
2239
|
+
const Le = X((e) => 1 / Math.sqrt(e)), xs = Q(Qt, Le), Fo = {
|
|
2240
|
+
kernelName: Qt,
|
|
2241
2241
|
backendName: "cpu",
|
|
2242
2242
|
kernelFunc: xs
|
|
2243
2243
|
};
|
|
@@ -2260,8 +2260,8 @@ const Le = X((e) => 1 / Math.sqrt(e)), xs = J(Jt, Le), Fo = {
|
|
|
2260
2260
|
function Es(e, t, n, s, o, a, r, i, l, u) {
|
|
2261
2261
|
const h = [s / o, o], f = e.values, p = t.values;
|
|
2262
2262
|
if (s === 0)
|
|
2263
|
-
return
|
|
2264
|
-
const w = l instanceof It ? l :
|
|
2263
|
+
return H(n, t.dtype);
|
|
2264
|
+
const w = l instanceof It ? l : H(h, t.dtype);
|
|
2265
2265
|
typeof l == "string" || typeof l == "number" ? w.values.fill(l) : typeof l == "boolean" && w.values.fill(+l);
|
|
2266
2266
|
for (let m = 0; m < a; m++) {
|
|
2267
2267
|
const F = [];
|
|
@@ -2293,8 +2293,8 @@ function Es(e, t, n, s, o, a, r, i, l, u) {
|
|
|
2293
2293
|
* limitations under the License.
|
|
2294
2294
|
* =============================================================================
|
|
2295
2295
|
*/
|
|
2296
|
-
const Fs = X((e) => 1 / (1 + Math.exp(-e))), ys = de(
|
|
2297
|
-
kernelName:
|
|
2296
|
+
const Fs = X((e) => 1 / (1 + Math.exp(-e))), ys = de(Yt, (e) => 1 / (1 + Math.exp(-e))), yo = {
|
|
2297
|
+
kernelName: Yt,
|
|
2298
2298
|
backendName: "cpu",
|
|
2299
2299
|
kernelFunc: ys
|
|
2300
2300
|
};
|
|
@@ -2314,13 +2314,13 @@ const Fs = X((e) => 1 / (1 + Math.exp(-e))), ys = de(Qt, (e) => 1 / (1 + Math.ex
|
|
|
2314
2314
|
* limitations under the License.
|
|
2315
2315
|
* =============================================================================
|
|
2316
2316
|
*/
|
|
2317
|
-
function
|
|
2318
|
-
const a = kn(s, t, n), r = V(n), i =
|
|
2317
|
+
function Pe(e, t, n, s, o) {
|
|
2318
|
+
const a = kn(s, t, n), r = V(n), i = K(s);
|
|
2319
2319
|
if (a) {
|
|
2320
2320
|
const f = Nn(t, i);
|
|
2321
2321
|
return o === "string" ? e.slice(f, f + r) : e.subarray(f, f + r);
|
|
2322
2322
|
}
|
|
2323
|
-
const l = o === "string" ? it(e) : e, u =
|
|
2323
|
+
const l = o === "string" ? it(e) : e, u = H(s, o, l), h = H(n, o);
|
|
2324
2324
|
for (let f = 0; f < h.size; ++f) {
|
|
2325
2325
|
const p = h.indexToLoc(f), w = p.map((m, F) => m + t[F]);
|
|
2326
2326
|
h.set(u.get(...w), ...p);
|
|
@@ -2332,11 +2332,11 @@ function ks(e) {
|
|
|
2332
2332
|
nt(o, "slice");
|
|
2333
2333
|
const [i, l] = Fn(o, a, r);
|
|
2334
2334
|
yn(o, i, l);
|
|
2335
|
-
const u = n.data.get(o.dataId).values, h =
|
|
2335
|
+
const u = n.data.get(o.dataId).values, h = Pe(u, i, l, o.shape, o.dtype);
|
|
2336
2336
|
return n.makeTensorInfo(l, o.dtype, h);
|
|
2337
2337
|
}
|
|
2338
2338
|
const ko = {
|
|
2339
|
-
kernelName:
|
|
2339
|
+
kernelName: Je,
|
|
2340
2340
|
backendName: "cpu",
|
|
2341
2341
|
kernelFunc: ks
|
|
2342
2342
|
};
|
|
@@ -2578,10 +2578,10 @@ const Ts = X((e) => Math.sqrt(e)), Rs = de(te, (e) => Math.sqrt(e)), No = {
|
|
|
2578
2578
|
* limitations under the License.
|
|
2579
2579
|
* =============================================================================
|
|
2580
2580
|
*/
|
|
2581
|
-
const
|
|
2581
|
+
const Ae = $((e, t) => {
|
|
2582
2582
|
const n = e - t;
|
|
2583
2583
|
return n * n;
|
|
2584
|
-
}), Ms = z(ee,
|
|
2584
|
+
}), Ms = z(ee, Ae), vo = {
|
|
2585
2585
|
kernelName: ee,
|
|
2586
2586
|
backendName: "cpu",
|
|
2587
2587
|
kernelFunc: Ms
|
|
@@ -2602,10 +2602,10 @@ const Pe = $((e, t) => {
|
|
|
2602
2602
|
* limitations under the License.
|
|
2603
2603
|
* =============================================================================
|
|
2604
2604
|
*/
|
|
2605
|
-
const
|
|
2605
|
+
const qe = X((e, t) => {
|
|
2606
2606
|
const { pattern: n, replaceGlobal: s, rewrite: o } = t;
|
|
2607
2607
|
return e.replace(new RegExp(n, s ? "g" : ""), o);
|
|
2608
|
-
}), Os =
|
|
2608
|
+
}), Os = Q(ne, qe), So = {
|
|
2609
2609
|
kernelName: ne,
|
|
2610
2610
|
backendName: "cpu",
|
|
2611
2611
|
kernelFunc: Os
|
|
@@ -2627,7 +2627,7 @@ const Ae = X((e, t) => {
|
|
|
2627
2627
|
* =============================================================================
|
|
2628
2628
|
*/
|
|
2629
2629
|
function Ls(e, t, n, s) {
|
|
2630
|
-
const o =
|
|
2630
|
+
const o = H(e, t.dtype);
|
|
2631
2631
|
for (let a = 0; a < o.size; a++) {
|
|
2632
2632
|
const r = o.indexToLoc(a), i = new Array(r.length);
|
|
2633
2633
|
for (let l = 0; l < i.length; l++)
|
|
@@ -2652,7 +2652,7 @@ function Ls(e, t, n, s) {
|
|
|
2652
2652
|
* limitations under the License.
|
|
2653
2653
|
* =============================================================================
|
|
2654
2654
|
*/
|
|
2655
|
-
class
|
|
2655
|
+
class Ps {
|
|
2656
2656
|
constructor(t, n, s, o, a, r) {
|
|
2657
2657
|
this.separator = pt(t), this.nGramWidths = n, this.leftPad = pt(s), this.rightPad = pt(o), this.padWidth = a, this.preserveShort = r;
|
|
2658
2658
|
}
|
|
@@ -2742,8 +2742,8 @@ class qs {
|
|
|
2742
2742
|
return [i, r];
|
|
2743
2743
|
}
|
|
2744
2744
|
}
|
|
2745
|
-
function
|
|
2746
|
-
return new
|
|
2745
|
+
function As(e, t, n, s, o, a, r, i) {
|
|
2746
|
+
return new Ps(n, s, o, a, r, i).compute(e, t);
|
|
2747
2747
|
}
|
|
2748
2748
|
/**
|
|
2749
2749
|
* @license
|
|
@@ -2761,7 +2761,7 @@ function Ps(e, t, n, s, o, a, r, i) {
|
|
|
2761
2761
|
* limitations under the License.
|
|
2762
2762
|
* =============================================================================
|
|
2763
2763
|
*/
|
|
2764
|
-
function
|
|
2764
|
+
function qs(e, t, n, s) {
|
|
2765
2765
|
if (!e.length)
|
|
2766
2766
|
return;
|
|
2767
2767
|
if (t.length === 0) {
|
|
@@ -2792,7 +2792,7 @@ function _s(e, t, n) {
|
|
|
2792
2792
|
const i = new Array(s);
|
|
2793
2793
|
for (let p = 0; p < s; ++p) {
|
|
2794
2794
|
const w = o.length;
|
|
2795
|
-
|
|
2795
|
+
qs(e[p], t, n, o);
|
|
2796
2796
|
const m = o.length - w;
|
|
2797
2797
|
i[p] = m, a += m, r = Math.max(r, m);
|
|
2798
2798
|
}
|
|
@@ -2822,7 +2822,7 @@ function _s(e, t, n) {
|
|
|
2822
2822
|
function Vs(e, t) {
|
|
2823
2823
|
const n = W("int32", e.length);
|
|
2824
2824
|
for (let s = 0; s < e.length; ++s)
|
|
2825
|
-
n[s] =
|
|
2825
|
+
n[s] = An(e[s]).modulo(t).getLowBitsUnsigned();
|
|
2826
2826
|
return n;
|
|
2827
2827
|
}
|
|
2828
2828
|
/**
|
|
@@ -2866,7 +2866,7 @@ function Ws(e, t) {
|
|
|
2866
2866
|
const n = new Array(e.rank);
|
|
2867
2867
|
for (let o = 0; o < n.length; o++)
|
|
2868
2868
|
n[o] = e.shape[o] * t[o];
|
|
2869
|
-
const s =
|
|
2869
|
+
const s = H(n, e.dtype);
|
|
2870
2870
|
for (let o = 0; o < s.values.length; ++o) {
|
|
2871
2871
|
const a = s.indexToLoc(o), r = new Array(e.rank);
|
|
2872
2872
|
for (let l = 0; l < r.length; l++)
|
|
@@ -2925,8 +2925,8 @@ function $s(e, t, n, s, o) {
|
|
|
2925
2925
|
}
|
|
2926
2926
|
const h = t.slice();
|
|
2927
2927
|
return h[h.length - 1] = s, [
|
|
2928
|
-
|
|
2929
|
-
|
|
2928
|
+
H(h, n, l),
|
|
2929
|
+
H(h, "int32", u)
|
|
2930
2930
|
];
|
|
2931
2931
|
}
|
|
2932
2932
|
/**
|
|
@@ -2946,7 +2946,7 @@ function $s(e, t, n, s, o) {
|
|
|
2946
2946
|
* =============================================================================
|
|
2947
2947
|
*/
|
|
2948
2948
|
function Us(e, t, n, s) {
|
|
2949
|
-
const o =
|
|
2949
|
+
const o = Jt(t, n)[0], a = [1, n[0], 1];
|
|
2950
2950
|
for (let m = 0; m < o; m++)
|
|
2951
2951
|
a[0] *= n[m];
|
|
2952
2952
|
a[1] = n[o];
|
|
@@ -3017,8 +3017,8 @@ const Ro = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3017
3017
|
expm1Impl: we,
|
|
3018
3018
|
floorDivImpl: be,
|
|
3019
3019
|
floorImpl: Ie,
|
|
3020
|
-
gatherNdImpl:
|
|
3021
|
-
gatherV2Impl:
|
|
3020
|
+
gatherNdImpl: Hn,
|
|
3021
|
+
gatherV2Impl: Kn,
|
|
3022
3022
|
greaterEqualImpl: Ee,
|
|
3023
3023
|
greaterImpl: xe,
|
|
3024
3024
|
lessEqualImpl: ye,
|
|
@@ -3040,15 +3040,15 @@ const Ro = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3040
3040
|
scatterImpl: Es,
|
|
3041
3041
|
sigmoidImpl: Fs,
|
|
3042
3042
|
simpleAbsImpl: le,
|
|
3043
|
-
sliceImpl:
|
|
3043
|
+
sliceImpl: Pe,
|
|
3044
3044
|
sparseFillEmptyRowsImpl: Ns,
|
|
3045
3045
|
sparseReshapeImpl: vs,
|
|
3046
3046
|
sparseSegmentReductionImpl: Ss,
|
|
3047
3047
|
sqrtImpl: Ts,
|
|
3048
|
-
squaredDifferenceImpl:
|
|
3049
|
-
staticRegexReplaceImpl:
|
|
3048
|
+
squaredDifferenceImpl: Ae,
|
|
3049
|
+
staticRegexReplaceImpl: qe,
|
|
3050
3050
|
stridedSliceImpl: Ls,
|
|
3051
|
-
stringNGramsImpl:
|
|
3051
|
+
stringNGramsImpl: As,
|
|
3052
3052
|
stringSplitImpl: _s,
|
|
3053
3053
|
stringToHashBucketFastImpl: Vs,
|
|
3054
3054
|
subImpl: _e,
|
|
@@ -3067,7 +3067,7 @@ export {
|
|
|
3067
3067
|
vs as F,
|
|
3068
3068
|
Ss as G,
|
|
3069
3069
|
Ls as H,
|
|
3070
|
-
|
|
3070
|
+
As as I,
|
|
3071
3071
|
_s as J,
|
|
3072
3072
|
Vs as K,
|
|
3073
3073
|
Ws as L,
|
|
@@ -3079,7 +3079,7 @@ export {
|
|
|
3079
3079
|
no as R,
|
|
3080
3080
|
to as S,
|
|
3081
3081
|
so as T,
|
|
3082
|
-
|
|
3082
|
+
Js as U,
|
|
3083
3083
|
oo as V,
|
|
3084
3084
|
ro as W,
|
|
3085
3085
|
ao as X,
|
|
@@ -3087,7 +3087,7 @@ export {
|
|
|
3087
3087
|
lo as Z,
|
|
3088
3088
|
co as _,
|
|
3089
3089
|
nt as a,
|
|
3090
|
-
|
|
3090
|
+
Qs as a0,
|
|
3091
3091
|
ho as a1,
|
|
3092
3092
|
fo as a2,
|
|
3093
3093
|
go as a3,
|
|
@@ -3097,7 +3097,7 @@ export {
|
|
|
3097
3097
|
Io as a7,
|
|
3098
3098
|
bo as a8,
|
|
3099
3099
|
Eo as a9,
|
|
3100
|
-
|
|
3100
|
+
Ys as aa,
|
|
3101
3101
|
Fo as ab,
|
|
3102
3102
|
yo as ac,
|
|
3103
3103
|
ko as ad,
|
|
@@ -3119,8 +3119,8 @@ export {
|
|
|
3119
3119
|
lt as l,
|
|
3120
3120
|
as as m,
|
|
3121
3121
|
Ds as n,
|
|
3122
|
-
|
|
3123
|
-
|
|
3122
|
+
Hn as o,
|
|
3123
|
+
Kn as p,
|
|
3124
3124
|
ts as q,
|
|
3125
3125
|
ce as r,
|
|
3126
3126
|
Ro as s,
|