@genai-fi/nanogpt 0.6.3 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Generator.js +11 -11
- package/dist/NanoGPTModel.d.ts +2 -2
- package/dist/NanoGPTModel.js +104 -136
- package/dist/{RealDiv-BYViZwhN.js → RealDiv-C4hOvYOZ.js} +26 -25
- package/dist/{Reshape-t7Kcikjk.js → Reshape-BLijOA8h.js} +5 -5
- package/dist/TeachableLLM.js +5 -5
- package/dist/{TiedEmbedding-9WeDwvjO.js → TiedEmbedding-BLltddza.js} +4 -4
- package/dist/{axis_util-Bu4h7XWV.js → axis_util-DaAl5MER.js} +3 -3
- package/dist/backend.d.ts +1 -0
- package/dist/backend.js +7 -0
- package/dist/backend_util-DWiwsi2N.js +749 -0
- package/dist/{broadcast_to-DARN-DBD.js → broadcast_to-C4v-j9yA.js} +2 -2
- package/dist/{concat-5aPGqw3Z.js → concat-CsHeR4zV.js} +8 -8
- package/dist/{dataset-pgqp-YfL.js → dataset-JDyjG3QR.js} +3 -3
- package/dist/{dropout-Bciw46HT.js → dropout-hpDwECTe.js} +7 -7
- package/dist/{gather-DjyCjmOD.js → gather-D0_gPiBz.js} +4 -4
- package/dist/gelu-uyHP1x1f.js +26 -0
- package/dist/gpgpu_math-DJm3ZTAf.js +2371 -0
- package/dist/index-BPPzKVdR.js +12099 -0
- package/dist/{index-BAzbokzv.js → index-C0dhsYom.js} +405 -389
- package/dist/{kernel_funcs_utils-CUxJCg0g.js → kernel_funcs_utils-CwRTFqrc.js} +31 -30
- package/dist/layers/BaseLayer.js +2 -2
- package/dist/layers/CausalSelfAttention.js +6 -6
- package/dist/layers/MLP.js +5 -5
- package/dist/layers/RMSNorm.js +3 -3
- package/dist/layers/RoPECache.js +4 -4
- package/dist/layers/TiedEmbedding.js +5 -5
- package/dist/layers/TransformerBlock.js +1 -1
- package/dist/loader/loadTransformers.js +1 -1
- package/dist/loader/oldZipLoad.js +5 -5
- package/dist/{log_sum_exp-YEo2h3gb.js → log_sum_exp-D086OgZJ.js} +15 -15
- package/dist/main.d.ts +2 -0
- package/dist/main.js +9 -5
- package/dist/{mat_mul-7121rsJk.js → mat_mul-1nwdPkQ_.js} +4 -4
- package/dist/{max-DtlIuVeW.js → max-BQc2Aj-I.js} +4 -4
- package/dist/{mulmat_packed_gpu-D4nKF7Je.js → mulmat_packed_gpu-Gzf3I9UV.js} +1 -1
- package/dist/non_max_suppression_impl-CsEgBuMA.js +134 -0
- package/dist/{ones-BBlSRqn1.js → ones-D63HpSF_.js} +2 -2
- package/dist/ops/appendCache.js +3 -3
- package/dist/ops/attentionMask.js +1 -1
- package/dist/ops/cpu/appendCache.js +8 -8
- package/dist/ops/cpu/attentionMask.js +9 -9
- package/dist/ops/cpu/fusedSoftmax.js +17 -11
- package/dist/ops/cpu/gatherSub.js +7 -7
- package/dist/ops/cpu/gelu.js +13 -13
- package/dist/ops/cpu/matMulGelu.js +36 -24
- package/dist/ops/cpu/matMulMul.js +14 -8
- package/dist/ops/cpu/mulDropout.js +9 -3
- package/dist/ops/cpu/normRMS.js +5 -5
- package/dist/ops/cpu/qkv.js +3 -3
- package/dist/ops/cpu/rope.js +5 -5
- package/dist/ops/cpu/scatterSub.js +11 -11
- 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 +3 -24
- package/dist/ops/grads/matMulGelu.js +5 -5
- package/dist/ops/grads/normRMS.js +6 -6
- package/dist/ops/grads/qkv.js +1 -1
- package/dist/ops/grads/rope.js +3 -3
- 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/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 +5 -5
- package/dist/ops/webgl/matMulGelu.js +17 -17
- package/dist/ops/webgl/matMulMul.js +1 -1
- package/dist/ops/webgl/mulDropout.js +4 -4
- 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/appendCache.d.ts +1 -0
- package/dist/ops/webgpu/appendCache.js +56 -0
- package/dist/ops/webgpu/attentionMask.d.ts +1 -0
- package/dist/ops/webgpu/attentionMask.js +64 -0
- package/dist/ops/webgpu/gatherSub.d.ts +1 -0
- package/dist/ops/webgpu/gatherSub.js +37 -0
- package/dist/ops/webgpu/gelu.d.ts +14 -0
- package/dist/ops/webgpu/gelu.js +86 -0
- package/dist/ops/webgpu/index.d.ts +0 -0
- package/dist/ops/webgpu/index.js +8 -0
- package/dist/ops/webgpu/normRMS.d.ts +1 -0
- package/dist/ops/webgpu/normRMS.js +115 -0
- package/dist/ops/webgpu/qkv.d.ts +1 -0
- package/dist/ops/webgpu/qkv.js +56 -0
- package/dist/ops/webgpu/rope.d.ts +1 -0
- package/dist/ops/webgpu/rope.js +68 -0
- package/dist/ops/webgpu/scatterSub.d.ts +1 -0
- package/dist/ops/webgpu/scatterSub.js +37 -0
- package/dist/{ops-C0sQEcPw.js → ops-CIQLNshk.js} +452 -503
- package/dist/{random_width-DWzaOgrn.js → random_width-DkYP8W8N.js} +143 -144
- package/dist/{range-DYsrnfiy.js → range-CYzpQY53.js} +1 -1
- package/dist/{reciprocal-CJQeasVa.js → reciprocal-_A9yv27J.js} +1 -1
- package/dist/{register_all_kernels-BfFCQAqs.js → register_all_kernels-guvSxp7M.js} +202 -200
- package/dist/{reshape-krWGKraP.js → reshape-BMUzc1UY.js} +3 -3
- package/dist/{scatter_nd_util-93ln7Hut.js → scatter_nd_util-IRBqKz_b.js} +3 -3
- package/dist/{selu_util-sntGesxr.js → selu_util-Dt_iuXaq.js} +6 -6
- package/dist/shared-BNa2q6jD.js +69 -0
- package/dist/{shared-Ca6iDobD.js → shared-CDu9S76h.js} +541 -606
- package/dist/{sin-D_h-qCSx.js → sin-Cocju-BY.js} +6 -6
- package/dist/{softmax-fsdtf6JC.js → softmax-GPNK3o-U.js} +3 -3
- package/dist/{split-eiktj-6L.js → split-CHzJjxDv.js} +4 -4
- package/dist/{stack-dfEEz2OY.js → stack-Dpgg_1W1.js} +2 -2
- package/dist/{sum-BE_Irnim.js → sum-B8wEpKsg.js} +5 -5
- package/dist/{tensor-Xyi595sG.js → tensor-RvZVNmg0.js} +1 -1
- package/dist/{tensor2d-CPEkynbH.js → tensor2d-B_kyod7_.js} +1 -1
- package/dist/training/AdamExt.js +1 -1
- package/dist/training/DatasetBuilder.js +2 -2
- package/dist/training/Evaluator.js +1 -1
- package/dist/training/FullTrainer.js +20 -20
- package/dist/training/Trainer.d.ts +5 -6
- package/dist/training/Trainer.js +59 -60
- package/dist/training/sparseCrossEntropy.js +4 -4
- package/dist/utilities/dummy.js +19 -19
- package/dist/utilities/generate.js +15 -16
- package/dist/utilities/multinomialCPU.d.ts +2 -0
- package/dist/utilities/multinomialCPU.js +13 -0
- package/dist/utilities/performance.d.ts +2 -0
- package/dist/utilities/performance.js +16 -0
- package/dist/utilities/profile.d.ts +1 -0
- package/dist/utilities/profile.js +9 -6
- package/dist/utilities/safetensors.js +2 -2
- package/dist/utilities/weights.js +2 -2
- package/dist/{variable-wSS22xj5.js → variable-DXEUOwew.js} +1 -1
- package/dist/webgpu_util-g13LvDIv.js +625 -0
- package/dist/{zeros-YJDE7oRb.js → zeros-DCPCdFGq.js} +8 -8
- package/package.json +2 -1
- package/dist/gpgpu_math-CNslybmD.js +0 -3115
- package/dist/norm-CzltS9Fz.js +0 -86
|
@@ -1,32 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { e as Dr, s as Er, l as Fr, a as Pr, b as Or, m as Ar, c as _r, r as Gs, f as $l, g as kl, h as wl, i as Nl, j as vl, k as Sl, n as Rl, o as Tl, q as Dl, t as El, u as Fl, v as Pl, w as Ol, x as Al, y as _l, z as Ll, A as Vl, B as Wl, C as Ml, p as Bl, F as Gl, G as zl, H as Ul, I as Hl, J as Xl, K as Kl, L as ql } from "./random_width-
|
|
3
|
-
import { r as re } from "./reshape-
|
|
4
|
-
import { b as jl } from "./broadcast_to-
|
|
5
|
-
import { c as os } from "./concat-
|
|
6
|
-
import { c as Yl, s as Ql } from "./sin-
|
|
7
|
-
import { w as Lr, n as ss, a as zs, r as Us,
|
|
8
|
-
import { m as Tt } from "./mat_mul-
|
|
9
|
-
import { w as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { s as
|
|
18
|
-
import { s as
|
|
19
|
-
import { s as
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import { c as wt } from "./scatter_nd_util-
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
1
|
+
import { x as oe, y as se, E as le, ck as ps, cl as hs, cn as en, co as fs, cp as ms, cr as gs, F as xs, cq as Cs, cs as bs, bp as To, l as Y, dd as tn, cy as sn, aj as Do, z as nn, br as Eo, cC as Is, cD as ys, cE as $s, ao as Nc, cH as on, q as vc, a as an, k as Ne, dl as ks, cK as rn, cL as ws, Q as It, bw as Fo, cP as Ns, dg as cn, dj as ln, b as Po, bA as Oo, ds as un, cR as vs, dv as dn, dw as pn, ai as xe, dx as S, aS as Sc, a6 as Rc, T as Ao, dy as Tc, cS as Dc, n as Ec, aT as Fc, aU as Pc, c as Oc, ac as L, d2 as _o, d3 as Lo, e as Me, aM as Vt, d7 as Vo, aK as Wo, d4 as Ac, aJ as Wt, ag as Ke, d8 as Mo, aq as hn, al as _c, j as z, bg as Ge, an as Lc, ar as fn, as as mn, I as Vc, a9 as Wc, H as Bo, Z as ne, cd as Go, cm as zo, bE as Uo, p as me, a2 as st, bF as Ho, bG as Xo, bH as Ko, ab as ct, bI as qo, ct as jo, cu as Yo, bL as Qo, bK as Zo, aO as Jo, dc as ea, bM as gn, cw as ta, aY as sa, M as na, bN as oa, by as Te, c9 as aa, bO as ra, bP as ia, cx as ca, bQ as la, a3 as xn, bR as Cn, b6 as ua, bS as da, u as nt, D as Mc, bT as pa, bU as ha, bV as fa, cb as ma, cc as ga, de as xa, bo as Ss, bi as Ft, bl as bn, cz as Kn, dz as mt, dA as Ca, cA as qn, df as Bc, U as Gc, aQ as ba, cB as Ia, bW as In, aV as ya, ax as $a, am as yt, d9 as ka, da as wa, b7 as Na, ca as va, di as Sa, $ as Ra, G as Ta, dk as Da, bX as yn, b0 as $n, bZ as kn, cG as Ea, N as zc, b_ as Fa, b$ as Pa, cI as Oa, cJ as Aa, dm as _a, c0 as La, aR as Va, bh as Wa, S as Ma, a5 as Ba, b9 as Ga, bb as za, ba as Ua, c1 as Ha, cT as Xa, c2 as Ka, P as qa, a0 as ja, c3 as Ya, cM as wn, dB as Qa, dC as Za, dD as Ja, R as er, O as Nn, bc as tr, cN as sr, bd as nr, cO as or, c5 as ar, b8 as rr, b3 as vn, _ as ir, dn as cr, aP as lr, c6 as Sn, a4 as Rn, c7 as Tn, bY as Dn, c4 as ur, dE as dr, dF as pr, dp as hr, dq as fr, dr as mr, J as gr, cQ as xr, at as En, dt as Cr, dG as br, dH as Ir, bJ as Fn, du as yr, L as $r, be as kr, av as Pn, b4 as wr, c8 as Nr, f as vr, dI as Sr, dJ as jn, d5 as Yn, d6 as Uc, t as Hc, dK as Xc, dL as Kc, bu as qc, b5 as jc, bf as Yc, bm as Qc, aN as Zc, bn as Jc, bv as el, b2 as tl, bj as sl, bk as nl, aG as Rr, bq as ol, a7 as al, ah as rl, bs as il, dh as cl, aW as ll, aX as ul, aZ as dl, a_ as pl, a8 as hl, bt as fl, b1 as ml, bC as gl, a$ as xl, aw as Tr, bx as Cl, ap as bl, bz as Il, bB as yl } from "./index-C0dhsYom.js";
|
|
2
|
+
import { e as Dr, s as Er, l as Fr, a as Pr, b as Or, m as Ar, c as _r, r as Gs, f as $l, g as kl, h as wl, i as Nl, j as vl, k as Sl, n as Rl, o as Tl, q as Dl, t as El, u as Fl, v as Pl, w as Ol, x as Al, y as _l, z as Ll, A as Vl, B as Wl, C as Ml, p as Bl, F as Gl, G as zl, H as Ul, I as Hl, J as Xl, K as Kl, L as ql } from "./random_width-DkYP8W8N.js";
|
|
3
|
+
import { r as re } from "./reshape-BMUzc1UY.js";
|
|
4
|
+
import { b as jl } from "./broadcast_to-C4v-j9yA.js";
|
|
5
|
+
import { c as os } from "./concat-CsHeR4zV.js";
|
|
6
|
+
import { c as Yl, s as Ql } from "./sin-Cocju-BY.js";
|
|
7
|
+
import { w as Lr, p as Vr, n as ss, a as zs, r as Us, q as Wr, s as as, f as Zl, g as Jl, d as eu, b as tu, e as su, o as nu, m as ou, v as au, x as ru, y as iu, j as cu, c as lu, t as uu, u as du } from "./ops-CIQLNshk.js";
|
|
8
|
+
import { m as Tt } from "./mat_mul-1nwdPkQ_.js";
|
|
9
|
+
import { w as Mr, k as Ye, h as Ve, x as pu, z as hu, A as fu, y as mu, D as gu, v as xu, i as ot, j as lt, d as De, e as $t, g as Rs, S as Br, a as Gr, B as zr, C as Ur, p as Cu, q as bu, r as Iu, u as yu } from "./selu_util-Dt_iuXaq.js";
|
|
10
|
+
import { e as $u, l as ku, a as wu } from "./log_sum_exp-D086OgZJ.js";
|
|
11
|
+
import { f as Nu } from "./dropout-hpDwECTe.js";
|
|
12
|
+
import { g as vu } from "./gather-D0_gPiBz.js";
|
|
13
|
+
import { c as Hs, z as Hr } from "./zeros-DCPCdFGq.js";
|
|
14
|
+
import { m as Su } from "./max-BQc2Aj-I.js";
|
|
15
|
+
import { r as Ru } from "./reciprocal-_A9yv27J.js";
|
|
16
|
+
import { s as Xs } from "./split-CHzJjxDv.js";
|
|
17
|
+
import { s as Tu } from "./softmax-GPNK3o-U.js";
|
|
18
|
+
import { s as Du } from "./stack-Dpgg_1W1.js";
|
|
19
|
+
import { s as Eu } from "./sum-B8wEpKsg.js";
|
|
20
|
+
import { a as j, u as ue, c as ut, i as dt, b as Fu, d as Pt, t as Pe, e as kt, f as gt, g as Xr, r as Ot, h as Be, j as Pu, k as Ou, l as On, z as Au, m as An, n as Kr, o as _u, p as Lu, q as Vu, v as Wu, w as Mu, x as Bu, y as Gu, A as zu, B as Uu, C as Hu, D as ft, E as Xu, F as Ku, G as qr, H as qu, I as ju, J as Yu, K as Qu, L as Zu, M as Ju, N as ed, O as td, P as sd, Q as nd, R as od, S as ad, T as rd, U as id, V as cd, W as ld, X as ud, Y as dd, Z as pd, _ as hd, $ as fd, a0 as md, a1 as gd, a2 as xd, a3 as Cd, a4 as bd, a5 as Id, a6 as yd, a7 as $d, a8 as kd, a9 as wd, aa as Nd, ab as vd, ac as Sd, ad as Rd, ae as Td, af as Dd, ag as Ed, ah as Fd, ai as Pd } from "./shared-CDu9S76h.js";
|
|
21
|
+
import { m as xt, A as Ts, B as Ds, C as Es, D as jr, F as Yr, H as Qr, G as je, I as Zr, J as Jr, K as ei, L as ti, M as si, z as ni, y as oi, x as ai, w as ri, u as ii, E as ci, T as li, U as Od, V as Ad, W as _d, X as Ld, Y as Vd, Z as Wd, N as ui, O as di, P as pi, Q as hi, c as fi, f as Md, S as Bd, _ as Gd } from "./backend_util-DWiwsi2N.js";
|
|
22
|
+
import { g as ye, a as $e, b as Re, c as Ee, e as Oe, h as Fs } from "./axis_util-DaAl5MER.js";
|
|
23
|
+
import { s as zd } from "./index-C4L8Cm77.js";
|
|
24
|
+
import { n as mi, b as gi, a as xi } from "./non_max_suppression_impl-CsEgBuMA.js";
|
|
25
|
+
import { c as wt } from "./scatter_nd_util-IRBqKz_b.js";
|
|
26
|
+
import { h as Qn, j as Ud, k as Hd, l as Xd, m as Kd, n as qd, o as jd, P as _n, p as ze, u as We, q as Ci, c as bi, T as _e, E as Ii, g as yi, a as $i, r as Yd, s as Qd, t as Z, v as Mt, w as Zd, x as Zn, y as Jd, z as ep, A as Bt, B as tp, C as sp, D as Ks, F as jt, G as Yt, H as np, I as op, J as Jn, K as ap, L as rp, M as Vs, N as ip, O as cp, Q as lp, R as Qt, S as Ws, U as up, f as Ce, V as we, W as Zt, X as Jt, Y as dp, d as eo, e as to, i as ki, Z as pp, _ as hp, $ as fp, a0 as mp, a1 as gp, a2 as xp, a3 as Gt } from "./gpgpu_math-DJm3ZTAf.js";
|
|
27
|
+
import { s as wi, a as Cp, t as Ni, b as bp, c as Ip, d as vi, e as yp, n as $p, f as kp, g as wp, h as Np, i as vp, j as Sp, k as Rp, l as Tp, o as Dp, p as Ep, q as Fp, r as Pp, u as Op, v as Ap, w as _p, x as Lp, y as Vp, z as Wp, A as Mp, B as Bp, C as Gp, D as zp, E as Up, F as Hp, G as Xp, H as Kp, I as qp, J as jp, K as Yp, L as Qp, M as Si, N as Zp, O as Jp, P as eh, Q as th, R as sh, S as nh, T as oh, U as ah, V as rh, W as ih } from "./shared-BNa2q6jD.js";
|
|
28
|
+
import { a as Se, c as ch, U as it, d as tt, e as qe, A as so, f as Nt, B as Ln, h as Vn, m as At, u as ae, C as Ue, b as ke, i as Le, j as Wn, k as pt, l as vt, n as lh, o as uh, p as dh, q as ph } from "./kernel_funcs_utils-CwRTFqrc.js";
|
|
29
|
+
import { R as hh, r as H, a as fh } from "./Reshape-BLijOA8h.js";
|
|
30
|
+
import { M as Ri } from "./mulmat_packed_gpu-Gzf3I9UV.js";
|
|
31
|
+
import { t as Ti, s as Mn, a as zt, m as mh, r as gh, b as xh, c as Ch, d as bh } from "./RealDiv-C4hOvYOZ.js";
|
|
30
32
|
/**
|
|
31
33
|
* @license
|
|
32
34
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
|
@@ -345,7 +347,7 @@ const Hh = /* @__PURE__ */ oe({ dot_: Uh });
|
|
|
345
347
|
* =============================================================================
|
|
346
348
|
*/
|
|
347
349
|
function Xh(o, t = null, e = !1) {
|
|
348
|
-
return
|
|
350
|
+
return Vr(o, "euclidean", t, e);
|
|
349
351
|
}
|
|
350
352
|
const Kh = /* @__PURE__ */ oe({ euclideanNorm_: Xh });
|
|
351
353
|
/**
|
|
@@ -476,7 +478,7 @@ const nf = /* @__PURE__ */ oe({ localResponseNormalization_: sf });
|
|
|
476
478
|
*/
|
|
477
479
|
function of(o) {
|
|
478
480
|
const t = se(o, "x", "logSigmoid");
|
|
479
|
-
return vc((n) => ({ value: ss(Er(ss(n))), gradFunc: (r) => an(r,
|
|
481
|
+
return vc((n) => ({ value: ss(Er(ss(n))), gradFunc: (r) => an(r, Mr(ss(n))) }))(t);
|
|
480
482
|
}
|
|
481
483
|
const af = /* @__PURE__ */ oe({ logSigmoid_: of });
|
|
482
484
|
/**
|
|
@@ -722,7 +724,7 @@ function wf(o) {
|
|
|
722
724
|
const s = re(o, [e, t]);
|
|
723
725
|
n = qs(s);
|
|
724
726
|
} else {
|
|
725
|
-
const s = [e, 2 * (t - 1)], a = re(Us(o), [e, t]), r = re(
|
|
727
|
+
const s = [e, 2 * (t - 1)], a = re(Us(o), [e, t]), r = re(Wr(o), [e, t]), i = Gs(as(a, [0, 1], [e, t - 2]), 1), c = an(Gs(as(r, [0, 1], [e, t - 2]), 1), Po(-1)), l = os([a, i], 1), u = os([r, c], 1), p = re(Hs(l, u), [s[0], s[1]]);
|
|
726
728
|
n = qs(p);
|
|
727
729
|
}
|
|
728
730
|
if (n = Us(n), o.rank === 3 && o.shape[0] !== 0) {
|
|
@@ -758,10 +760,10 @@ function vf(o, t) {
|
|
|
758
760
|
m[o.shape.length - 1] = t, s = as(o, f, m), e = t;
|
|
759
761
|
} else if (t != null && t > e) {
|
|
760
762
|
const f = o.shape.map((m) => m);
|
|
761
|
-
f[o.shape.length - 1] = t - e, s = os([o,
|
|
763
|
+
f[o.shape.length - 1] = t - e, s = os([o, Hr(f)], o.shape.length - 1), e = t;
|
|
762
764
|
} else
|
|
763
765
|
s = o;
|
|
764
|
-
const a = nn(s), r = re(Hs(s, a), [n, e]), i = Ei(r), c = Math.floor(e / 2) + 1, l = Us(i), u =
|
|
766
|
+
const a = nn(s), r = re(Hs(s, a), [n, e]), i = Ei(r), c = Math.floor(e / 2) + 1, l = Us(i), u = Wr(i), p = Xs(l, [c, e - c], l.shape.length - 1), d = Xs(u, [c, e - c], u.shape.length - 1), h = s.shape.slice();
|
|
765
767
|
return h[s.shape.length - 1] = c, re(Hs(p[0], d[0]), h);
|
|
766
768
|
}
|
|
767
769
|
const Sf = /* @__PURE__ */ oe({ rfft_: vf });
|
|
@@ -1698,7 +1700,7 @@ S().prototype.dot = function(o) {
|
|
|
1698
1700
|
* =============================================================================
|
|
1699
1701
|
*/
|
|
1700
1702
|
S().prototype.elu = function() {
|
|
1701
|
-
return this.throwIfDisposed(),
|
|
1703
|
+
return this.throwIfDisposed(), pu(this);
|
|
1702
1704
|
};
|
|
1703
1705
|
/**
|
|
1704
1706
|
* @license
|
|
@@ -2059,7 +2061,7 @@ S().prototype.isNaN = function() {
|
|
|
2059
2061
|
* =============================================================================
|
|
2060
2062
|
*/
|
|
2061
2063
|
S().prototype.leakyRelu = function(o) {
|
|
2062
|
-
return this.throwIfDisposed(),
|
|
2064
|
+
return this.throwIfDisposed(), hu(this, o);
|
|
2063
2065
|
};
|
|
2064
2066
|
/**
|
|
2065
2067
|
* @license
|
|
@@ -2385,7 +2387,7 @@ S().prototype.mean = function(o, t) {
|
|
|
2385
2387
|
* =============================================================================
|
|
2386
2388
|
*/
|
|
2387
2389
|
S().prototype.min = function(o, t) {
|
|
2388
|
-
return this.throwIfDisposed(),
|
|
2390
|
+
return this.throwIfDisposed(), nu(this, o, t);
|
|
2389
2391
|
};
|
|
2390
2392
|
/**
|
|
2391
2393
|
* @license
|
|
@@ -2404,7 +2406,7 @@ S().prototype.min = function(o, t) {
|
|
|
2404
2406
|
* =============================================================================
|
|
2405
2407
|
*/
|
|
2406
2408
|
S().prototype.minimum = function(o) {
|
|
2407
|
-
return this.throwIfDisposed(),
|
|
2409
|
+
return this.throwIfDisposed(), ou(this, o);
|
|
2408
2410
|
};
|
|
2409
2411
|
/**
|
|
2410
2412
|
* @license
|
|
@@ -2499,7 +2501,7 @@ S().prototype.neg = function() {
|
|
|
2499
2501
|
* =============================================================================
|
|
2500
2502
|
*/
|
|
2501
2503
|
S().prototype.norm = function(o, t, e) {
|
|
2502
|
-
return this.throwIfDisposed(),
|
|
2504
|
+
return this.throwIfDisposed(), Vr(this, o, t, e);
|
|
2503
2505
|
};
|
|
2504
2506
|
/**
|
|
2505
2507
|
* @license
|
|
@@ -2616,7 +2618,7 @@ S().prototype.pow = function(o) {
|
|
|
2616
2618
|
* =============================================================================
|
|
2617
2619
|
*/
|
|
2618
2620
|
S().prototype.prelu = function(o) {
|
|
2619
|
-
return this.throwIfDisposed(),
|
|
2621
|
+
return this.throwIfDisposed(), fu(this, o);
|
|
2620
2622
|
};
|
|
2621
2623
|
/**
|
|
2622
2624
|
* @license
|
|
@@ -2673,7 +2675,7 @@ S().prototype.reciprocal = function() {
|
|
|
2673
2675
|
* =============================================================================
|
|
2674
2676
|
*/
|
|
2675
2677
|
S().prototype.relu = function() {
|
|
2676
|
-
return this.throwIfDisposed(),
|
|
2678
|
+
return this.throwIfDisposed(), mu(this);
|
|
2677
2679
|
};
|
|
2678
2680
|
/**
|
|
2679
2681
|
* @license
|
|
@@ -2692,7 +2694,7 @@ S().prototype.relu = function() {
|
|
|
2692
2694
|
* =============================================================================
|
|
2693
2695
|
*/
|
|
2694
2696
|
S().prototype.relu6 = function() {
|
|
2695
|
-
return this.throwIfDisposed(),
|
|
2697
|
+
return this.throwIfDisposed(), gu(this);
|
|
2696
2698
|
};
|
|
2697
2699
|
/**
|
|
2698
2700
|
* @license
|
|
@@ -2749,7 +2751,7 @@ S().prototype.reshape = function(o) {
|
|
|
2749
2751
|
* =============================================================================
|
|
2750
2752
|
*/
|
|
2751
2753
|
S().prototype.resizeBilinear = function(o, t, e) {
|
|
2752
|
-
return this.throwIfDisposed(),
|
|
2754
|
+
return this.throwIfDisposed(), au(this, o, t, e);
|
|
2753
2755
|
};
|
|
2754
2756
|
/**
|
|
2755
2757
|
* @license
|
|
@@ -2768,7 +2770,7 @@ S().prototype.resizeBilinear = function(o, t, e) {
|
|
|
2768
2770
|
* =============================================================================
|
|
2769
2771
|
*/
|
|
2770
2772
|
S().prototype.resizeNearestNeighbor = function(o, t, e) {
|
|
2771
|
-
return this.throwIfDisposed(),
|
|
2773
|
+
return this.throwIfDisposed(), ru(this, o, t, e);
|
|
2772
2774
|
};
|
|
2773
2775
|
/**
|
|
2774
2776
|
* @license
|
|
@@ -2825,7 +2827,7 @@ S().prototype.rfft = function() {
|
|
|
2825
2827
|
* =============================================================================
|
|
2826
2828
|
*/
|
|
2827
2829
|
S().prototype.round = function() {
|
|
2828
|
-
return this.throwIfDisposed(),
|
|
2830
|
+
return this.throwIfDisposed(), iu(this);
|
|
2829
2831
|
};
|
|
2830
2832
|
/**
|
|
2831
2833
|
* @license
|
|
@@ -2901,7 +2903,7 @@ S().prototype.separableConv2d = function(o, t, e, n, s, a) {
|
|
|
2901
2903
|
* =============================================================================
|
|
2902
2904
|
*/
|
|
2903
2905
|
S().prototype.sigmoid = function() {
|
|
2904
|
-
return this.throwIfDisposed(),
|
|
2906
|
+
return this.throwIfDisposed(), Mr(this);
|
|
2905
2907
|
};
|
|
2906
2908
|
/**
|
|
2907
2909
|
* @license
|
|
@@ -3129,7 +3131,7 @@ S().prototype.squaredDifference = function(o) {
|
|
|
3129
3131
|
* =============================================================================
|
|
3130
3132
|
*/
|
|
3131
3133
|
S().prototype.squeeze = function(o) {
|
|
3132
|
-
return this.throwIfDisposed(),
|
|
3134
|
+
return this.throwIfDisposed(), cu(this, o);
|
|
3133
3135
|
};
|
|
3134
3136
|
/**
|
|
3135
3137
|
* @license
|
|
@@ -3169,7 +3171,7 @@ S().prototype.stack = function(o, t) {
|
|
|
3169
3171
|
* =============================================================================
|
|
3170
3172
|
*/
|
|
3171
3173
|
S().prototype.step = function(o) {
|
|
3172
|
-
return this.throwIfDisposed(),
|
|
3174
|
+
return this.throwIfDisposed(), xu(this, o);
|
|
3173
3175
|
};
|
|
3174
3176
|
/**
|
|
3175
3177
|
* @license
|
|
@@ -3283,7 +3285,7 @@ S().prototype.tanh = function() {
|
|
|
3283
3285
|
* =============================================================================
|
|
3284
3286
|
*/
|
|
3285
3287
|
S().prototype.tile = function(o) {
|
|
3286
|
-
return this.throwIfDisposed(),
|
|
3288
|
+
return this.throwIfDisposed(), lu(this, o);
|
|
3287
3289
|
};
|
|
3288
3290
|
/**
|
|
3289
3291
|
* @license
|
|
@@ -3378,7 +3380,7 @@ S().prototype.topk = function(o, t) {
|
|
|
3378
3380
|
* =============================================================================
|
|
3379
3381
|
*/
|
|
3380
3382
|
S().prototype.transpose = function(o) {
|
|
3381
|
-
return this.throwIfDisposed(),
|
|
3383
|
+
return this.throwIfDisposed(), uu(this, o);
|
|
3382
3384
|
};
|
|
3383
3385
|
/**
|
|
3384
3386
|
* @license
|
|
@@ -3435,7 +3437,7 @@ S().prototype.unsortedSegmentSum = function(o, t) {
|
|
|
3435
3437
|
* =============================================================================
|
|
3436
3438
|
*/
|
|
3437
3439
|
S().prototype.unstack = function(o) {
|
|
3438
|
-
return this.throwIfDisposed(),
|
|
3440
|
+
return this.throwIfDisposed(), du(this, o);
|
|
3439
3441
|
};
|
|
3440
3442
|
/**
|
|
3441
3443
|
* @license
|
|
@@ -4677,7 +4679,7 @@ const Em = {
|
|
|
4677
4679
|
function Fm(o) {
|
|
4678
4680
|
const { inputs: t, backend: e, attrs: n } = o, { x: s } = t, { blockShape: a, crops: r } = n;
|
|
4679
4681
|
j([s], "batchToSpaceND");
|
|
4680
|
-
const i = a.reduce((g, C) => g * C), c = Ts(s.shape, a, i), l = Ds(c.length, a.length), u = Es(s.shape, a, i), p =
|
|
4682
|
+
const i = a.reduce((g, C) => g * C), c = Ts(s.shape, a, i), l = Ds(c.length, a.length), u = Es(s.shape, a, i), p = jr(r, a.length), d = Yr(u, r, a.length), h = he({ inputs: { x: s }, backend: e, attrs: { shape: c } }), f = Pe({ inputs: { x: h }, backend: e, attrs: { perm: l } }), m = he({ inputs: { x: f }, backend: e, attrs: { shape: u } }), x = gt({
|
|
4681
4683
|
inputs: { x: m },
|
|
4682
4684
|
backend: e,
|
|
4683
4685
|
attrs: { begin: p, size: d }
|
|
@@ -4706,7 +4708,7 @@ const Pm = {
|
|
|
4706
4708
|
* =============================================================================
|
|
4707
4709
|
*/
|
|
4708
4710
|
function Om(o) {
|
|
4709
|
-
const { inputs: t, backend: e, attrs: n } = o, { x: s, weights: a } = t, { size: r } = n, i = e.data.get(s.dataId).values, c = e.data.get(a.dataId).values, l =
|
|
4711
|
+
const { inputs: t, backend: e, attrs: n } = o, { x: s, weights: a } = t, { size: r } = n, i = e.data.get(s.dataId).values, c = e.data.get(a.dataId).values, l = Xr(i, c, a.dtype, a.shape, r);
|
|
4710
4712
|
return e.makeTensorInfo([r], a.dtype, l);
|
|
4711
4713
|
}
|
|
4712
4714
|
const Am = {
|
|
@@ -4834,7 +4836,7 @@ const Gm = {
|
|
|
4834
4836
|
*/
|
|
4835
4837
|
function bt(o) {
|
|
4836
4838
|
const { inputs: t, backend: e, attrs: n } = o, { axis: s } = n, a = me(s, t[0].shape)[0], r = t.map((m) => m.shape);
|
|
4837
|
-
|
|
4839
|
+
Qr(r, a);
|
|
4838
4840
|
let i = je(t.map((m) => m.shape), a);
|
|
4839
4841
|
if (z(i) === 0)
|
|
4840
4842
|
return e.makeTensorInfo(i, t[0].dtype, []);
|
|
@@ -5427,7 +5429,7 @@ const ug = {
|
|
|
5427
5429
|
function dg(o) {
|
|
5428
5430
|
const { inputs: t, backend: e, attrs: n } = o, { x: s, weights: a } = t, { size: r, binaryOutput: i } = n;
|
|
5429
5431
|
if (s.shape.length === 1) {
|
|
5430
|
-
const c = e.data.get(s.dataId).values, l = e.data.get(a.dataId).values, u =
|
|
5432
|
+
const c = e.data.get(s.dataId).values, l = e.data.get(a.dataId).values, u = Xr(c, l, a.dtype, a.shape, r);
|
|
5431
5433
|
return e.makeTensorInfo([r], a.dtype, u);
|
|
5432
5434
|
} else if (s.shape.length === 2) {
|
|
5433
5435
|
const c = e.bufferSync(s), l = e.bufferSync(a), u = Ou(c, l, r, i);
|
|
@@ -5937,16 +5939,16 @@ const Sg = {
|
|
|
5937
5939
|
* =============================================================================
|
|
5938
5940
|
*/
|
|
5939
5941
|
function Rg(o) {
|
|
5940
|
-
const { inputs: t, backend: e, attrs: n } = o, { equation: s } = n, a = t, { allDims: r, summedDims: i, idDims: c } =
|
|
5941
|
-
|
|
5942
|
-
const { path: l, steps: u } =
|
|
5942
|
+
const { inputs: t, backend: e, attrs: n } = o, { equation: s } = n, a = t, { allDims: r, summedDims: i, idDims: c } = Zr(s, a.length);
|
|
5943
|
+
Jr(r.length, c, a);
|
|
5944
|
+
const { path: l, steps: u } = ei(i, c), p = u.length;
|
|
5943
5945
|
let d = null, h = r.length;
|
|
5944
5946
|
const f = [];
|
|
5945
5947
|
for (let m = 0; m < p; ++m) {
|
|
5946
5948
|
for (const x of u[m]) {
|
|
5947
|
-
const { permutationIndices: g, expandDims: C } =
|
|
5949
|
+
const { permutationIndices: g, expandDims: C } = ti(h, c[x]);
|
|
5948
5950
|
let I;
|
|
5949
|
-
|
|
5951
|
+
si(g) ? I = a[x] : (I = Pe({ inputs: { x: a[x] }, backend: e, attrs: { perm: g } }), f.push(I));
|
|
5950
5952
|
const b = I.shape.slice();
|
|
5951
5953
|
for (let y = 0; y < C.length; ++y)
|
|
5952
5954
|
b.splice(C[y], 0, 1);
|
|
@@ -6017,7 +6019,7 @@ const Eg = {
|
|
|
6017
6019
|
* limitations under the License.
|
|
6018
6020
|
* =============================================================================
|
|
6019
6021
|
*/
|
|
6020
|
-
const Fg =
|
|
6022
|
+
const Fg = ci, Pg = ii, Og = ri, Ag = ai, _g = oi, Lg = ni, Vg = ue(In, (o) => {
|
|
6021
6023
|
const t = Math.sign(o), e = Math.abs(o), n = 1 / (1 + Fg * e);
|
|
6022
6024
|
return t * (1 - ((((Lg * n + _g) * n + Ag) * n + Og) * n + Pg) * n * Math.exp(-e * e));
|
|
6023
6025
|
}), Wg = {
|
|
@@ -6101,7 +6103,7 @@ function zi(o, t, e) {
|
|
|
6101
6103
|
attrs: { begin: [x, 0], size: [1, a] }
|
|
6102
6104
|
}), I = Be({ inputs: { real: g, imag: C }, backend: e }), { real: b, imag: y } = Gg(I, t, e), $ = xt(b, y);
|
|
6103
6105
|
for (let k = 0; k < a; k++) {
|
|
6104
|
-
const w =
|
|
6106
|
+
const w = li($, k);
|
|
6105
6107
|
p[x * a + k] = w.real, d[x * a + k] = w.imag;
|
|
6106
6108
|
}
|
|
6107
6109
|
e.disposeIntermediateTensorInfo(g), e.disposeIntermediateTensorInfo(C), e.disposeIntermediateTensorInfo(I);
|
|
@@ -6120,7 +6122,7 @@ function Gg(o, t, e) {
|
|
|
6120
6122
|
return i;
|
|
6121
6123
|
} else {
|
|
6122
6124
|
const i = xt(a, r), c = Ug(i, n, t);
|
|
6123
|
-
return
|
|
6125
|
+
return Od(c);
|
|
6124
6126
|
}
|
|
6125
6127
|
}
|
|
6126
6128
|
function zg(o) {
|
|
@@ -6129,13 +6131,13 @@ function zg(o) {
|
|
|
6129
6131
|
function Ys(o, t, e, n, s) {
|
|
6130
6132
|
if (e === 1)
|
|
6131
6133
|
return { real: o, imag: t };
|
|
6132
|
-
const a = xt(o, t), r = e / 2, i =
|
|
6134
|
+
const a = xt(o, t), r = e / 2, i = Ad(a), c = i.real, l = i.imag, u = [c.length], p = s.makeTensorInfo(u, "float32", c), d = s.makeTensorInfo(u, "float32", l), h = Be({ inputs: { real: p, imag: d }, backend: s }), f = _d(a), m = f.real, x = f.imag, g = [m.length], C = s.makeTensorInfo(g, "float32", m), I = s.makeTensorInfo(g, "float32", x), b = Be({ inputs: { real: C, imag: I }, backend: s }), y = Ys(c, l, r, n, s), $ = y.real, k = y.imag, w = [$.length], v = s.makeTensorInfo(w, "float32", $), N = s.makeTensorInfo(w, "float32", k), P = Be({
|
|
6133
6135
|
inputs: { real: v, imag: N },
|
|
6134
6136
|
backend: s
|
|
6135
|
-
}), O = Ys(m, x, r, n, s), E = O.real, F = O.imag, T = [E.length], D = s.makeTensorInfo(T, "float32", E), _ = s.makeTensorInfo(T, "float32", F), R = Be({ inputs: { real: D, imag: _ }, backend: s }), A =
|
|
6137
|
+
}), O = Ys(m, x, r, n, s), E = O.real, F = O.imag, T = [E.length], D = s.makeTensorInfo(T, "float32", E), _ = s.makeTensorInfo(T, "float32", F), R = Be({ inputs: { real: D, imag: _ }, backend: s }), A = Ld(e, n), W = [A.real.length], V = s.makeTensorInfo(W, "float32", A.real), G = s.makeTensorInfo(W, "float32", A.imag), M = Be({ inputs: { real: V, imag: G }, backend: s }), U = An({ inputs: { a: M, b: R }, backend: s }), B = Pt({
|
|
6136
6138
|
inputs: { a: P, b: U },
|
|
6137
6139
|
backend: s
|
|
6138
|
-
}), X =
|
|
6140
|
+
}), X = Kr({
|
|
6139
6141
|
inputs: { a: P, b: U },
|
|
6140
6142
|
backend: s
|
|
6141
6143
|
}), q = Ot({ inputs: { input: B }, backend: s }), J = Ot({ inputs: { input: X }, backend: s }), Q = Ct({ inputs: { input: B }, backend: s }), ee = Ct({ inputs: { input: X }, backend: s }), te = bt({
|
|
@@ -6154,10 +6156,10 @@ function Ug(o, t, e) {
|
|
|
6154
6156
|
for (let s = 0; s < t; s++) {
|
|
6155
6157
|
let a = 0, r = 0;
|
|
6156
6158
|
for (let i = 0; i < t; i++) {
|
|
6157
|
-
const c =
|
|
6159
|
+
const c = Wd(s * i, t, e), l = li(o, i);
|
|
6158
6160
|
a += l.real * c.real - l.imag * c.imag, r += l.real * c.imag + l.imag * c.real;
|
|
6159
6161
|
}
|
|
6160
|
-
e && (a /= t, r /= t),
|
|
6162
|
+
e && (a /= t, r /= t), Vd(n, a, r, s);
|
|
6161
6163
|
}
|
|
6162
6164
|
return n;
|
|
6163
6165
|
}
|
|
@@ -6367,7 +6369,7 @@ const Jg = {
|
|
|
6367
6369
|
* =============================================================================
|
|
6368
6370
|
*/
|
|
6369
6371
|
function ex(o) {
|
|
6370
|
-
const { inputs: t, backend: e } = o, { params: n, indices: s } = t, a = z(n.shape), r = s.shape, i = r[r.length - 1], [c, l, u, p] =
|
|
6372
|
+
const { inputs: t, backend: e } = o, { params: n, indices: s } = t, a = z(n.shape), r = s.shape, i = r[r.length - 1], [c, l, u, p] = ui(n, s);
|
|
6371
6373
|
if (l === 0)
|
|
6372
6374
|
return e.makeTensorInfo(c, n.dtype, []);
|
|
6373
6375
|
const d = e.data.get(s.dataId).values, h = e.bufferSync(n), f = _u(d, h, n.dtype, l, i, u, p, n.shape, a);
|
|
@@ -6404,7 +6406,7 @@ function sx(o) {
|
|
|
6404
6406
|
}
|
|
6405
6407
|
let p = i;
|
|
6406
6408
|
i == null && (p = 0);
|
|
6407
|
-
const d = z(a.shape), h =
|
|
6409
|
+
const d = z(a.shape), h = di(s, a, c, p), f = he({
|
|
6408
6410
|
inputs: { x: s },
|
|
6409
6411
|
backend: e,
|
|
6410
6412
|
attrs: {
|
|
@@ -7132,7 +7134,7 @@ function Hi(o) {
|
|
|
7132
7134
|
inputs: { x: s },
|
|
7133
7135
|
backend: e,
|
|
7134
7136
|
attrs: { reductionIndices: c, keepDims: !1 }
|
|
7135
|
-
}), u = Oe(l.shape, c), p = he({ inputs: { x: l }, backend: e, attrs: { shape: u } }), d =
|
|
7137
|
+
}), u = Oe(l.shape, c), p = he({ inputs: { x: l }, backend: e, attrs: { shape: u } }), d = Kr({ inputs: { a: s, b: p }, backend: e }), h = Bu({ inputs: { x: d }, backend: e }), f = Ut({ inputs: { x: h }, backend: e, attrs: { axis: c, keepDims: !1 } }), m = he({ inputs: { x: f }, backend: e, attrs: { shape: u } }), x = Gn({ inputs: { a: h, b: m }, backend: e });
|
|
7136
7138
|
return e.disposeIntermediateTensorInfo(l), e.disposeIntermediateTensorInfo(p), e.disposeIntermediateTensorInfo(d), e.disposeIntermediateTensorInfo(h), e.disposeIntermediateTensorInfo(f), e.disposeIntermediateTensorInfo(m), x;
|
|
7137
7139
|
}
|
|
7138
7140
|
const qx = {
|
|
@@ -7165,7 +7167,7 @@ function jx(o) {
|
|
|
7165
7167
|
x[0] = p[m];
|
|
7166
7168
|
for (let I = 1; I < x.length; ++I)
|
|
7167
7169
|
x[I] = x[I - 1] + p[m + I];
|
|
7168
|
-
const g =
|
|
7170
|
+
const g = zd.alea(r.toString()), C = f * a;
|
|
7169
7171
|
for (let I = 0; I < a; ++I) {
|
|
7170
7172
|
const b = g();
|
|
7171
7173
|
h[C + I] = x.length;
|
|
@@ -7199,7 +7201,7 @@ const Yx = {
|
|
|
7199
7201
|
* limitations under the License.
|
|
7200
7202
|
* =============================================================================
|
|
7201
7203
|
*/
|
|
7202
|
-
const Qx =
|
|
7204
|
+
const Qx = mi;
|
|
7203
7205
|
function Zx(o) {
|
|
7204
7206
|
const { inputs: t, backend: e, attrs: n } = o, { boxes: s, scores: a } = t, { maxOutputSize: r, iouThreshold: i, scoreThreshold: c } = n;
|
|
7205
7207
|
j(s, "NonMaxSuppression");
|
|
@@ -7227,7 +7229,7 @@ const Jx = {
|
|
|
7227
7229
|
* limitations under the License.
|
|
7228
7230
|
* =============================================================================
|
|
7229
7231
|
*/
|
|
7230
|
-
const eC =
|
|
7232
|
+
const eC = gi;
|
|
7231
7233
|
function tC(o) {
|
|
7232
7234
|
const { inputs: t, backend: e, attrs: n } = o, { boxes: s, scores: a } = t, { maxOutputSize: r, iouThreshold: i, scoreThreshold: c, padToMaxOutputSize: l } = n;
|
|
7233
7235
|
j(s, "NonMaxSuppressionPadded");
|
|
@@ -7258,7 +7260,7 @@ const sC = {
|
|
|
7258
7260
|
* limitations under the License.
|
|
7259
7261
|
* =============================================================================
|
|
7260
7262
|
*/
|
|
7261
|
-
const nC =
|
|
7263
|
+
const nC = xi;
|
|
7262
7264
|
function oC(o) {
|
|
7263
7265
|
const { inputs: t, backend: e, attrs: n } = o, { boxes: s, scores: a } = t, { maxOutputSize: r, iouThreshold: i, scoreThreshold: c, softNmsSigma: l } = n;
|
|
7264
7266
|
j(s, "NonMaxSuppressionWithScore");
|
|
@@ -7842,7 +7844,7 @@ const AC = {
|
|
|
7842
7844
|
kernelName: rr,
|
|
7843
7845
|
backendName: "cpu",
|
|
7844
7846
|
kernelFunc: ({ inputs: o, attrs: t, backend: e }) => {
|
|
7845
|
-
const { image: n } = o, { radians: s, fillValue: a, center: r } = t, i = e, c = Ge(n.dtype, z(n.shape)), [l, u, p, d] = n.shape, [h, f] =
|
|
7847
|
+
const { image: n } = o, { radians: s, fillValue: a, center: r } = t, i = e, c = Ge(n.dtype, z(n.shape)), [l, u, p, d] = n.shape, [h, f] = pi(r, u, p), m = 255, x = Math.sin(s), g = Math.cos(s), C = i.data.get(n.dataId).values;
|
|
7846
7848
|
for (let b = 0; b < l; b++) {
|
|
7847
7849
|
const y = b * p * u * d;
|
|
7848
7850
|
for (let $ = 0; $ < u; $++) {
|
|
@@ -8026,7 +8028,7 @@ const XC = {
|
|
|
8026
8028
|
* limitations under the License.
|
|
8027
8029
|
* =============================================================================
|
|
8028
8030
|
*/
|
|
8029
|
-
const KC =
|
|
8031
|
+
const KC = Gr, qC = Br, jC = ue(Sn, (o) => o >= 0 ? qC * o : KC * (Math.exp(o) - 1)), YC = {
|
|
8030
8032
|
kernelName: Sn,
|
|
8031
8033
|
backendName: "cpu",
|
|
8032
8034
|
kernelFunc: jC
|
|
@@ -8262,7 +8264,7 @@ function pb(o) {
|
|
|
8262
8264
|
${a.shape}`);
|
|
8263
8265
|
if (s.shape[0] !== a.shape[0])
|
|
8264
8266
|
throw new Error("segmentIds and indices should have same size.");
|
|
8265
|
-
const r = e.data.get(n.dataId).values, i = e.data.get(s.dataId).values, c = e.data.get(a.dataId).values, [l, u] =
|
|
8267
|
+
const r = e.data.get(n.dataId).values, i = e.data.get(s.dataId).values, c = e.data.get(a.dataId).values, [l, u] = qr(r, n.shape, n.dtype, i, c, !0);
|
|
8266
8268
|
return e.makeTensorInfo(u, n.dtype, l);
|
|
8267
8269
|
}
|
|
8268
8270
|
const hb = {
|
|
@@ -8298,7 +8300,7 @@ function fb(o) {
|
|
|
8298
8300
|
${a.shape}`);
|
|
8299
8301
|
if (s.shape[0] !== a.shape[0])
|
|
8300
8302
|
throw new Error("segmentIds and indices should have same size.");
|
|
8301
|
-
const r = e.data.get(n.dataId).values, i = e.data.get(s.dataId).values, c = e.data.get(a.dataId).values, [l, u] =
|
|
8303
|
+
const r = e.data.get(n.dataId).values, i = e.data.get(s.dataId).values, c = e.data.get(a.dataId).values, [l, u] = qr(r, n.shape, n.dtype, i, c);
|
|
8302
8304
|
return e.makeTensorInfo(u, n.dtype, l);
|
|
8303
8305
|
}
|
|
8304
8306
|
const mb = {
|
|
@@ -8373,7 +8375,7 @@ const xb = {
|
|
|
8373
8375
|
* =============================================================================
|
|
8374
8376
|
*/
|
|
8375
8377
|
function Cb(o) {
|
|
8376
|
-
const { inputs: t, backend: e, attrs: n } = o, { x: s } = t, { numOrSizeSplits: a, axis: r } = n, i = me(r, s.shape)[0], c =
|
|
8378
|
+
const { inputs: t, backend: e, attrs: n } = o, { x: s } = t, { numOrSizeSplits: a, axis: r } = n, i = me(r, s.shape)[0], c = hi(s, a, i), l = new Array(s.shape.length).fill(0), u = s.shape.slice();
|
|
8377
8379
|
return c.map((p) => {
|
|
8378
8380
|
const d = [...u];
|
|
8379
8381
|
d[i] = p;
|
|
@@ -8459,13 +8461,13 @@ const yb = ue(En, (o, t) => {
|
|
|
8459
8461
|
function kb(o) {
|
|
8460
8462
|
const { inputs: t, backend: e, attrs: n } = o, { x: s } = t, { begin: a, end: r, strides: i, beginMask: c, endMask: l, ellipsisMask: u, newAxisMask: p, shrinkAxisMask: d } = n;
|
|
8461
8463
|
j(s, "stridedSlice");
|
|
8462
|
-
const { finalShapeSparse: h, finalShape: f, isIdentity: m, sliceDim0: x, isSimpleSlice: g, begin: C, end: I, strides: b } =
|
|
8464
|
+
const { finalShapeSparse: h, finalShape: f, isIdentity: m, sliceDim0: x, isSimpleSlice: g, begin: C, end: I, strides: b } = zr(s.shape, a, r, i, c, l, u, p, d);
|
|
8463
8465
|
let y;
|
|
8464
8466
|
if (m)
|
|
8465
8467
|
y = he({ inputs: { x: s }, backend: e, attrs: { shape: f } });
|
|
8466
8468
|
else if (x || g) {
|
|
8467
8469
|
Y(s.shape.length >= 1, () => `Input must have rank at least 1, got: ${s.shape.length}`);
|
|
8468
|
-
const $ =
|
|
8470
|
+
const $ = Ur(C, I, b), k = gt({ inputs: { x: s }, backend: e, attrs: { begin: C, size: $ } });
|
|
8469
8471
|
y = he({ inputs: { x: k }, backend: e, attrs: { shape: f } }), e.disposeIntermediateTensorInfo(k);
|
|
8470
8472
|
} else {
|
|
8471
8473
|
const $ = e.bufferSync(s), k = qu(h, $, b, C);
|
|
@@ -9148,17 +9150,17 @@ K.registerFlag("WEBGL_PACK_REDUCE", () => K.getBool("WEBGL_PACK"));
|
|
|
9148
9150
|
K.registerFlag("WEBGL_LAZILY_UNPACK", () => K.getBool("WEBGL_PACK"));
|
|
9149
9151
|
K.registerFlag("WEBGL_CONV_IM2COL", () => K.getBool("WEBGL_PACK"));
|
|
9150
9152
|
K.registerFlag("WEBGL_PACK_CONV2DTRANSPOSE", () => K.getBool("WEBGL_PACK"));
|
|
9151
|
-
K.registerFlag("WEBGL_MAX_TEXTURE_SIZE", () =>
|
|
9152
|
-
K.registerFlag("WEBGL_MAX_TEXTURES_IN_SHADER", () =>
|
|
9153
|
+
K.registerFlag("WEBGL_MAX_TEXTURE_SIZE", () => Ud(K.getNumber("WEBGL_VERSION")));
|
|
9154
|
+
K.registerFlag("WEBGL_MAX_TEXTURES_IN_SHADER", () => Hd(K.getNumber("WEBGL_VERSION")));
|
|
9153
9155
|
K.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION", () => {
|
|
9154
9156
|
const o = K.getNumber("WEBGL_VERSION");
|
|
9155
|
-
return o === 0 ? 0 :
|
|
9157
|
+
return o === 0 ? 0 : Xd(o);
|
|
9156
9158
|
});
|
|
9157
9159
|
K.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE", () => K.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION") > 0 && !Sr());
|
|
9158
|
-
K.registerFlag("WEBGL_RENDER_FLOAT32_CAPABLE", () =>
|
|
9160
|
+
K.registerFlag("WEBGL_RENDER_FLOAT32_CAPABLE", () => Kd(K.getNumber("WEBGL_VERSION")));
|
|
9159
9161
|
K.registerFlag("WEBGL_RENDER_FLOAT32_ENABLED", () => K.getBool("WEBGL_FORCE_F16_TEXTURES") ? !1 : K.getBool("WEBGL_RENDER_FLOAT32_CAPABLE"));
|
|
9160
|
-
K.registerFlag("WEBGL_DOWNLOAD_FLOAT_ENABLED", () =>
|
|
9161
|
-
K.registerFlag("WEBGL_FENCE_API_ENABLED", () =>
|
|
9162
|
+
K.registerFlag("WEBGL_DOWNLOAD_FLOAT_ENABLED", () => qd(K.getNumber("WEBGL_VERSION")));
|
|
9163
|
+
K.registerFlag("WEBGL_FENCE_API_ENABLED", () => jd(K.getNumber("WEBGL_VERSION")));
|
|
9162
9164
|
K.registerFlag("WEBGL_SIZE_UPLOAD_UNIFORM", () => K.getBool("WEBGL_RENDER_FLOAT32_ENABLED") ? 4 : 0);
|
|
9163
9165
|
K.registerFlag("WEBGL_DELETE_TEXTURE_THRESHOLD", () => -1, (o) => {
|
|
9164
9166
|
if (typeof o != "number")
|
|
@@ -9204,7 +9206,7 @@ class s1 {
|
|
|
9204
9206
|
const e = ze();
|
|
9205
9207
|
this.outputShape = t, this.enableShapeUniforms = We(this.outputShape.length), this.userCode = `
|
|
9206
9208
|
ivec3 outCoordsFromFlatIndex(int index) {
|
|
9207
|
-
${this.enableShapeUniforms ?
|
|
9209
|
+
${this.enableShapeUniforms ? Ci(["r", "c", "d"], t) : bi(["r", "c", "d"], t)}
|
|
9208
9210
|
return ivec3(r, c, d);
|
|
9209
9211
|
}
|
|
9210
9212
|
|
|
@@ -9247,7 +9249,7 @@ class n1 {
|
|
|
9247
9249
|
const e = ze();
|
|
9248
9250
|
this.outputShape = t, this.enableShapeUniforms = We(this.outputShape.length), this.userCode = `
|
|
9249
9251
|
ivec3 outCoordsFromFlatIndex(int index) {
|
|
9250
|
-
${this.enableShapeUniforms ?
|
|
9252
|
+
${this.enableShapeUniforms ? Ci(["r", "c", "d"], t) : bi(["r", "c", "d"], t)}
|
|
9251
9253
|
return ivec3(r, c, d);
|
|
9252
9254
|
}
|
|
9253
9255
|
|
|
@@ -9289,7 +9291,7 @@ class o1 {
|
|
|
9289
9291
|
this.variableNames = ["A"], this.outTexUsage = _e.DOWNLOAD;
|
|
9290
9292
|
const e = ze();
|
|
9291
9293
|
this.outputShape = t, this.userCode = `
|
|
9292
|
-
${
|
|
9294
|
+
${Ii}
|
|
9293
9295
|
|
|
9294
9296
|
void main() {
|
|
9295
9297
|
float x = getAAtOutCoords();
|
|
@@ -9319,7 +9321,7 @@ class a1 {
|
|
|
9319
9321
|
this.variableNames = ["A"], this.packedInputs = !0, this.packedOutput = !1, this.outTexUsage = _e.DOWNLOAD;
|
|
9320
9322
|
const e = ze();
|
|
9321
9323
|
this.outputShape = t, this.userCode = `
|
|
9322
|
-
${
|
|
9324
|
+
${Ii}
|
|
9323
9325
|
|
|
9324
9326
|
void main() {
|
|
9325
9327
|
ivec3 coords = getOutputCoords();
|
|
@@ -9367,7 +9369,7 @@ class io {
|
|
|
9367
9369
|
}`;
|
|
9368
9370
|
}
|
|
9369
9371
|
this.userCode = `
|
|
9370
|
-
${this.enableShapeUniforms ?
|
|
9372
|
+
${this.enableShapeUniforms ? yi() : $i(t)}
|
|
9371
9373
|
|
|
9372
9374
|
void main() {
|
|
9373
9375
|
ivec3 coords = getOutputCoords();
|
|
@@ -9446,7 +9448,7 @@ class i1 {
|
|
|
9446
9448
|
`;
|
|
9447
9449
|
}
|
|
9448
9450
|
this.userCode = `
|
|
9449
|
-
${this.enableShapeUniforms ?
|
|
9451
|
+
${this.enableShapeUniforms ? yi() : $i(t)}
|
|
9450
9452
|
|
|
9451
9453
|
void main() {
|
|
9452
9454
|
ivec3 coords = getOutputCoords();
|
|
@@ -9491,19 +9493,19 @@ function c1(o) {
|
|
|
9491
9493
|
gl_Position = vec4(clipSpacePos, 1);
|
|
9492
9494
|
resultUV = uv;
|
|
9493
9495
|
}`;
|
|
9494
|
-
return
|
|
9496
|
+
return Zd(o, e);
|
|
9495
9497
|
}
|
|
9496
9498
|
function l1(o) {
|
|
9497
9499
|
const t = new Float32Array([-1, 1, 0, 0, 1, -1, -1, 0, 0, 0, 1, 1, 0, 1, 1, 1, -1, 0, 1, 0]);
|
|
9498
|
-
return
|
|
9500
|
+
return Yd(o, t);
|
|
9499
9501
|
}
|
|
9500
9502
|
function u1(o) {
|
|
9501
9503
|
const t = new Uint16Array([0, 1, 2, 2, 1, 3]);
|
|
9502
|
-
return
|
|
9504
|
+
return Qd(o, t);
|
|
9503
9505
|
}
|
|
9504
9506
|
function Ht(o, t, e, n, s, a) {
|
|
9505
|
-
|
|
9506
|
-
const r =
|
|
9507
|
+
Jd(t, e);
|
|
9508
|
+
const r = ep(o), i = o.TEXTURE_2D;
|
|
9507
9509
|
return Z(o, () => o.bindTexture(i, r)), Z(o, () => o.texParameteri(i, o.TEXTURE_WRAP_S, o.CLAMP_TO_EDGE)), Z(o, () => o.texParameteri(i, o.TEXTURE_WRAP_T, o.CLAMP_TO_EDGE)), Z(o, () => o.texParameteri(i, o.TEXTURE_MIN_FILTER, o.NEAREST)), Z(o, () => o.texParameteri(i, o.TEXTURE_MAG_FILTER, o.NEAREST)), L().getNumber("WEBGL_VERSION") === 1 ? Z(o, () => o.texImage2D(i, 0, n, t, e, 0, s, a, null)) : Z(o, () => o.texStorage2D(i, 1, n, t, e)), Z(o, () => o.bindTexture(o.TEXTURE_2D, null)), { texture: r, texShape: [e, t] };
|
|
9508
9510
|
}
|
|
9509
9511
|
function ji(o) {
|
|
@@ -9563,11 +9565,11 @@ function I1(o, t, e) {
|
|
|
9563
9565
|
return n.bindBuffer(n.PIXEL_PACK_BUFFER, t), n.getBufferSubData(n.PIXEL_PACK_BUFFER, 0, s), n.bindBuffer(n.PIXEL_PACK_BUFFER, null), s;
|
|
9564
9566
|
}
|
|
9565
9567
|
function y1(o, t, e, n) {
|
|
9566
|
-
const [s, a] = Mt(t, e), r = 4, i = new Uint8Array(
|
|
9568
|
+
const [s, a] = Mt(t, e), r = 4, i = new Uint8Array(tp(t * e, r));
|
|
9567
9569
|
return Z(o, () => o.readPixels(0, 0, s, a, n.downloadTextureFormat, o.UNSIGNED_BYTE, i)), new Float32Array(i.buffer);
|
|
9568
9570
|
}
|
|
9569
9571
|
function $1(o, t, e, n, s, a, r, i) {
|
|
9570
|
-
const c = o, l = new Float32Array(
|
|
9572
|
+
const c = o, l = new Float32Array(sp(a, r));
|
|
9571
9573
|
return c.bindBuffer(c.PIXEL_PACK_BUFFER, t), c.getBufferSubData(c.PIXEL_PACK_BUFFER, 0, l), c.bindBuffer(c.PIXEL_PACK_BUFFER, null), l;
|
|
9572
9574
|
}
|
|
9573
9575
|
function k1(o, t, e) {
|
|
@@ -9594,7 +9596,7 @@ class Ms {
|
|
|
9594
9596
|
constructor(t) {
|
|
9595
9597
|
this.outputTexture = null, this.program = null, this.disposed = !1, this.itemsToPoll = [];
|
|
9596
9598
|
const e = L().getNumber("WEBGL_VERSION");
|
|
9597
|
-
if (t != null ? (this.gl = t,
|
|
9599
|
+
if (t != null ? (this.gl = t, up(e, t)) : this.gl = Ks(e), t = this.gl, L().getNumber("WEBGL_VERSION") === 2) {
|
|
9598
9600
|
const a = t;
|
|
9599
9601
|
this.createVertexArray = () => Z(a, () => a.createVertexArray()), this.bindVertexArray = (r) => Z(a, () => a.bindVertexArray(r)), this.deleteVertexArray = (r) => Z(a, () => a.deleteVertexArray(r)), this.getVertexArray = () => Z(a, () => a.getParameter(a.VERTEX_ARRAY_BINDING));
|
|
9600
9602
|
} else if (t != null) {
|
|
@@ -9621,7 +9623,7 @@ class Ms {
|
|
|
9621
9623
|
this.colorBufferHalfFloatExtension = this.gl.getExtension(s);
|
|
9622
9624
|
else
|
|
9623
9625
|
throw new Error("GL context does not support color renderable floats");
|
|
9624
|
-
this.vertexBuffer = l1(this.gl), this.indexBuffer = u1(this.gl), this.framebuffer =
|
|
9626
|
+
this.vertexBuffer = l1(this.gl), this.indexBuffer = u1(this.gl), this.framebuffer = np(this.gl), this.textureConfig = op(this.gl, this.textureHalfFloatExtension);
|
|
9625
9627
|
}
|
|
9626
9628
|
get debug() {
|
|
9627
9629
|
return L().getBool("DEBUG");
|
|
@@ -9693,8 +9695,8 @@ class Ms {
|
|
|
9693
9695
|
this.throwIfDisposed();
|
|
9694
9696
|
const e = this.gl;
|
|
9695
9697
|
this.vertexShader == null && (this.vertexShader = c1(e));
|
|
9696
|
-
const n =
|
|
9697
|
-
Z(e, () => e.attachShader(n, this.vertexShader)), Z(e, () => e.attachShader(n, t)),
|
|
9698
|
+
const n = ap(e);
|
|
9699
|
+
Z(e, () => e.attachShader(n, this.vertexShader)), Z(e, () => e.attachShader(n, t)), rp(e, n);
|
|
9698
9700
|
const s = Object.assign(n, { vao: this.createVertexArray() });
|
|
9699
9701
|
return this.debug && Vs(e, s), s;
|
|
9700
9702
|
}
|
|
@@ -9710,7 +9712,7 @@ class Ms {
|
|
|
9710
9712
|
this.throwIfDisposed(), this.program = t, this.program != null && this.debug && Vs(this.gl, this.program), Z(this.gl, () => this.gl.useProgram(t));
|
|
9711
9713
|
}
|
|
9712
9714
|
getUniformLocation(t, e, n = !0) {
|
|
9713
|
-
return this.throwIfDisposed(), n ?
|
|
9715
|
+
return this.throwIfDisposed(), n ? ip(this.gl, t, e) : cp(this.gl, t, e);
|
|
9714
9716
|
}
|
|
9715
9717
|
getAttributeLocation(t, e) {
|
|
9716
9718
|
return this.throwIfDisposed(), Z(this.gl, () => this.gl.getAttribLocation(t, e));
|
|
@@ -9719,7 +9721,7 @@ class Ms {
|
|
|
9719
9721
|
return this.throwIfDisposed(), this.gl.getUniformLocation(t, e);
|
|
9720
9722
|
}
|
|
9721
9723
|
setInputMatrixTexture(t, e, n) {
|
|
9722
|
-
this.throwIfDisposed(), this.throwIfNoProgram(),
|
|
9724
|
+
this.throwIfDisposed(), this.throwIfNoProgram(), lp(this.gl, t, e, n);
|
|
9723
9725
|
}
|
|
9724
9726
|
setOutputMatrixTexture(t, e, n) {
|
|
9725
9727
|
this.setOutputMatrixTextureDriver(t, n, e);
|
|
@@ -10297,7 +10299,7 @@ class Os extends _o {
|
|
|
10297
10299
|
if (t != null)
|
|
10298
10300
|
for (let e = 0; e < t.length; e++) {
|
|
10299
10301
|
const n = t[e];
|
|
10300
|
-
if (!
|
|
10302
|
+
if (!dp(n))
|
|
10301
10303
|
throw L().getBool("WEBGL_RENDER_FLOAT32_CAPABLE") ? Error(`The value ${n} cannot be represented with your current settings. Consider enabling float32 rendering: 'tf.env().set('WEBGL_RENDER_FLOAT32_ENABLED', true);'`) : Error(`The value ${n} cannot be represented on this device.`);
|
|
10302
10304
|
}
|
|
10303
10305
|
}
|
|
@@ -10423,7 +10425,7 @@ class Os extends _o {
|
|
|
10423
10425
|
// Also remove the op from unary_op.
|
|
10424
10426
|
abs(t) {
|
|
10425
10427
|
if (this.shouldExecuteOnCPU([t]) && t.dtype !== "complex64") {
|
|
10426
|
-
const s =
|
|
10428
|
+
const s = wi(this.texData.get(t.dataId).values);
|
|
10427
10429
|
return this.makeOutput(t.shape, t.dtype, s);
|
|
10428
10430
|
}
|
|
10429
10431
|
if (L().getBool("WEBGL_PACK_UNARY_OPERATIONS"))
|
|
@@ -10501,16 +10503,16 @@ class Os extends _o {
|
|
|
10501
10503
|
}
|
|
10502
10504
|
if (this.uploadToGPU(g.dataId), !!C.isPacked != !!t.packedInputs)
|
|
10503
10505
|
g = C.isPacked ? this.unpackTensor(g) : this.packTensor(g), l.push(g), C = this.texData.get(g.dataId);
|
|
10504
|
-
else if (C.isPacked && !
|
|
10506
|
+
else if (C.isPacked && !ki(C.shape, g.shape)) {
|
|
10505
10507
|
const I = g, b = g.shape;
|
|
10506
10508
|
g.shape = C.shape, g = this.packedReshape(g, b), l.push(g), C = this.texData.get(g.dataId), I.shape = b;
|
|
10507
10509
|
}
|
|
10508
10510
|
return { shape: g.shape, texData: C, isUniform: !1 };
|
|
10509
10511
|
});
|
|
10510
10512
|
this.uploadToGPU(i.dataId);
|
|
10511
|
-
const p = { shape: i.shape, texData: c, isUniform: !1 }, d =
|
|
10513
|
+
const p = { shape: i.shape, texData: c, isUniform: !1 }, d = pp(t, u, p), h = this.getAndSaveBinary(d, () => hp(this.gpgpu, t, u, p)), f = this.activeTimers != null;
|
|
10512
10514
|
let m;
|
|
10513
|
-
f && (m = this.startTimer()), L().get("ENGINE_COMPILE_ONLY") ||
|
|
10515
|
+
f && (m = this.startTimer()), L().get("ENGINE_COMPILE_ONLY") || fp(this.gpgpu, h, u, p, s), l.forEach((g) => this.disposeIntermediateTensorInfo(g)), f && (m = this.endTimer(m), this.activeTimers.push({ name: t.constructor.name, query: this.getQueryTime(m) }));
|
|
10514
10516
|
const x = L().getNumber("WEBGL_FLUSH_THRESHOLD");
|
|
10515
10517
|
if (x > 0) {
|
|
10516
10518
|
const g = Ke();
|
|
@@ -10560,7 +10562,7 @@ class Os extends _o {
|
|
|
10560
10562
|
let u;
|
|
10561
10563
|
l && (u = Ke());
|
|
10562
10564
|
let p = e.texShape;
|
|
10563
|
-
if (p == null && (p =
|
|
10565
|
+
if (p == null && (p = mp(n, c), e.texShape = p), a != null) {
|
|
10564
10566
|
const d = Zt(n);
|
|
10565
10567
|
let h, f = p[1], m = p[0];
|
|
10566
10568
|
const x = a instanceof Uint8Array || a instanceof Uint8ClampedArray;
|
|
@@ -10617,13 +10619,13 @@ class Os extends _o {
|
|
|
10617
10619
|
}
|
|
10618
10620
|
checkCompletion_(t) {
|
|
10619
10621
|
if (this.gpgpu.gl.getProgramParameter(t.webGLProgram, this.gpgpu.gl.LINK_STATUS) === !1)
|
|
10620
|
-
throw console.log(this.gpgpu.gl.getProgramInfoLog(t.webGLProgram)), this.gpgpu.gl.getShaderParameter(t.fragmentShader, this.gpgpu.gl.COMPILE_STATUS) === !1 ? (
|
|
10622
|
+
throw console.log(this.gpgpu.gl.getProgramInfoLog(t.webGLProgram)), this.gpgpu.gl.getShaderParameter(t.fragmentShader, this.gpgpu.gl.COMPILE_STATUS) === !1 ? (gp(t.source, this.gpgpu.gl.getShaderInfoLog(t.fragmentShader)), new Error("Failed to compile fragment shader.")) : new Error("Failed to link vertex and fragment shaders.");
|
|
10621
10623
|
return !0;
|
|
10622
10624
|
}
|
|
10623
10625
|
getUniformLocations() {
|
|
10624
10626
|
for (const t of Object.values(this.binaryCache)) {
|
|
10625
10627
|
this.gpgpu.buildVao(t.webGLProgram);
|
|
10626
|
-
const { variablesLocations: e, customUniformLocations: n, infLoc: s, nanLoc: a, outShapeLocation: r, outShapeStridesLocation: i, outTexShapeLocation: c } =
|
|
10628
|
+
const { variablesLocations: e, customUniformLocations: n, infLoc: s, nanLoc: a, outShapeLocation: r, outShapeStridesLocation: i, outTexShapeLocation: c } = xp(this.gpgpu, t.program, t.webGLProgram);
|
|
10627
10629
|
t.variablesLocations = e, t.customUniformLocations = n, t.infLoc = s, t.nanLoc = a, t.outShapeLocation = r, t.outShapeStridesLocation = i, t.outTexShapeLocation = c;
|
|
10628
10630
|
}
|
|
10629
10631
|
}
|
|
@@ -10757,7 +10759,7 @@ function Un(o) {
|
|
|
10757
10759
|
return e.disposeIntermediateTensorInfo(d), e.disposeIntermediateTensorInfo(h), f;
|
|
10758
10760
|
}
|
|
10759
10761
|
if (e.shouldExecuteOnCPU([n, s])) {
|
|
10760
|
-
const i = e.texData.get(n.dataId), c = e.texData.get(s.dataId), [l, u] =
|
|
10762
|
+
const i = e.texData.get(n.dataId), c = e.texData.get(s.dataId), [l, u] = Cp(n.shape, s.shape, i.values, c.values, a), p = e.makeTensorInfo(u, a), d = e.texData.get(p.dataId);
|
|
10761
10763
|
return d.values = l, p;
|
|
10762
10764
|
}
|
|
10763
10765
|
let r;
|
|
@@ -10790,7 +10792,7 @@ function ve(o) {
|
|
|
10790
10792
|
c[u] = s.shape[a[u]];
|
|
10791
10793
|
let l;
|
|
10792
10794
|
if (r.shouldExecuteOnCPU([s])) {
|
|
10793
|
-
const p = r.texData.get(s.dataId).values, d =
|
|
10795
|
+
const p = r.texData.get(s.dataId).values, d = Ni(p, s.shape, s.dtype, a, c);
|
|
10794
10796
|
l = r.makeTensorInfo(c, s.dtype);
|
|
10795
10797
|
const h = r.texData.get(l.dataId);
|
|
10796
10798
|
h.values = d;
|
|
@@ -10913,7 +10915,7 @@ const mo = "return abs(x);";
|
|
|
10913
10915
|
function z1(o) {
|
|
10914
10916
|
const { inputs: t, backend: e } = o, { x: n } = t;
|
|
10915
10917
|
if (e.shouldExecuteOnCPU([n]) && n.dtype !== "complex64") {
|
|
10916
|
-
const a = e.texData.get(n.dataId), r =
|
|
10918
|
+
const a = e.texData.get(n.dataId), r = wi(a.values);
|
|
10917
10919
|
return e.makeTensorInfo(n.shape, n.dtype, r);
|
|
10918
10920
|
}
|
|
10919
10921
|
let s;
|
|
@@ -10993,7 +10995,7 @@ const go = "return a + b;", Q1 = ke({
|
|
|
10993
10995
|
opSnippet: go,
|
|
10994
10996
|
packedOpSnippet: go,
|
|
10995
10997
|
supportsComplex: !0,
|
|
10996
|
-
cpuKernelImpl:
|
|
10998
|
+
cpuKernelImpl: bp
|
|
10997
10999
|
}), Z1 = {
|
|
10998
11000
|
kernelName: Qc,
|
|
10999
11001
|
backendName: "webgl",
|
|
@@ -11332,7 +11334,7 @@ class iI {
|
|
|
11332
11334
|
function tc(o, t, e, n = null) {
|
|
11333
11335
|
let s = t.shape[0], a = t.shape[1];
|
|
11334
11336
|
n != null && (s = n.shape[0], a = n.shape[1]);
|
|
11335
|
-
const r =
|
|
11337
|
+
const r = fi(a), i = { windowSize: r, inSize: a, batchSize: s, outSize: Math.ceil(a / r) }, c = new rI(i, e, n == null), l = [t];
|
|
11336
11338
|
n != null && l.push(n);
|
|
11337
11339
|
const u = o.runWebGLProgram(c, l, "int32");
|
|
11338
11340
|
if (u.shape[1] === 1)
|
|
@@ -11341,7 +11343,7 @@ function tc(o, t, e, n = null) {
|
|
|
11341
11343
|
return o.disposeIntermediateTensorInfo(u), p;
|
|
11342
11344
|
}
|
|
11343
11345
|
function sc(o, t, e, n = null) {
|
|
11344
|
-
const s = n != null ? n.shape : t.shape, a = s[s.length - 1], r =
|
|
11346
|
+
const s = n != null ? n.shape : t.shape, a = s[s.length - 1], r = fi(a), i = new iI(s, r, e, n == null), c = n == null ? [t] : [t, n], l = o.runWebGLProgram(i, c, "int32");
|
|
11345
11347
|
if (l.shape.length === t.shape.length) {
|
|
11346
11348
|
const u = sc(o, t, e, l);
|
|
11347
11349
|
return o.disposeIntermediateTensorInfo(l), u;
|
|
@@ -12390,7 +12392,7 @@ class XI {
|
|
|
12390
12392
|
function KI(o, t, e, n) {
|
|
12391
12393
|
const s = n.texData.get(o.dataId), a = n.makeTensorInfo(e, o.dtype), r = n.texData.get(a.dataId);
|
|
12392
12394
|
Object.assign(r, s), r.refCount = 1, r.shape = e, r.dtype = o.dtype;
|
|
12393
|
-
let i =
|
|
12395
|
+
let i = yu(t, ne(o.shape));
|
|
12394
12396
|
s.slice && (i += s.slice.flatOffset), r.slice = {
|
|
12395
12397
|
flatOffset: i,
|
|
12396
12398
|
// Point to the original dataId, which is used to do ref counting.
|
|
@@ -12400,14 +12402,14 @@ function KI(o, t, e, n) {
|
|
|
12400
12402
|
return n.dataRefCount.set(r.slice.origDataId, c + 1), a;
|
|
12401
12403
|
}
|
|
12402
12404
|
function St(o) {
|
|
12403
|
-
const { inputs: t, backend: e, attrs: n } = o, { x: s } = t, { begin: a, size: r } = n, [i, c] =
|
|
12404
|
-
if (
|
|
12405
|
+
const { inputs: t, backend: e, attrs: n } = o, { x: s } = t, { begin: a, size: r } = n, [i, c] = Cu(s, a, r);
|
|
12406
|
+
if (bu(s, i, c), z(c) === 0)
|
|
12405
12407
|
return e.makeTensorInfo(c, s.dtype, []);
|
|
12406
12408
|
if (e.shouldExecuteOnCPU([s]) || s.dtype === "string") {
|
|
12407
|
-
const p = e.texData.get(s.dataId), d =
|
|
12409
|
+
const p = e.texData.get(s.dataId), d = Ip(p.values, i, c, s.shape, s.dtype);
|
|
12408
12410
|
return e.makeTensorInfo(c, s.dtype, d);
|
|
12409
12411
|
}
|
|
12410
|
-
const { isPacked: l } = e.texData.get(s.dataId), u =
|
|
12412
|
+
const { isPacked: l } = e.texData.get(s.dataId), u = Iu(s.shape, i, c);
|
|
12411
12413
|
if (l || !u) {
|
|
12412
12414
|
const p = L().getBool("WEBGL_PACK_ARRAY_OPERATIONS") ? new XI(c) : new UI(c), d = [i];
|
|
12413
12415
|
return e.runWebGLProgram(p, [s], s.dtype, d);
|
|
@@ -12438,7 +12440,7 @@ const qI = {
|
|
|
12438
12440
|
const jI = (o) => {
|
|
12439
12441
|
const { inputs: t, backend: e, attrs: n } = o, { x: s } = t, { blockShape: a, crops: r } = n;
|
|
12440
12442
|
Y(s.shape.length <= 4, () => "batchToSpaceND for rank > 4 with a WebGL backend not implemented yet");
|
|
12441
|
-
const i = a.reduce((C, I) => C * I), c = Ts(s.shape, a, i), l = Ds(c.length, a.length), u = Es(s.shape, a, i), p =
|
|
12443
|
+
const i = a.reduce((C, I) => C * I), c = Ts(s.shape, a, i), l = Ds(c.length, a.length), u = Es(s.shape, a, i), p = jr(r, a.length), d = Yr(u, r, a.length), h = [], f = H({ inputs: { x: s }, backend: e, attrs: { shape: c } }), m = ve({ inputs: { x: f }, backend: e, attrs: { perm: l } }), x = H({
|
|
12442
12444
|
inputs: { x: m },
|
|
12443
12445
|
backend: e,
|
|
12444
12446
|
attrs: { shape: u }
|
|
@@ -12470,7 +12472,7 @@ const jI = (o) => {
|
|
|
12470
12472
|
* =============================================================================
|
|
12471
12473
|
*/
|
|
12472
12474
|
function QI(o) {
|
|
12473
|
-
const { inputs: t, backend: e, attrs: n } = o, { x: s, weights: a } = t, { size: r } = n, i = e.readSync(s.dataId), c = e.readSync(a.dataId), l =
|
|
12475
|
+
const { inputs: t, backend: e, attrs: n } = o, { x: s, weights: a } = t, { size: r } = n, i = e.readSync(s.dataId), c = e.readSync(a.dataId), l = vi(i, c, a.dtype, a.shape, r);
|
|
12474
12476
|
return e.makeTensorInfo([r], a.dtype, l);
|
|
12475
12477
|
}
|
|
12476
12478
|
const ZI = {
|
|
@@ -12506,7 +12508,7 @@ const JI = `
|
|
|
12506
12508
|
function ty(o) {
|
|
12507
12509
|
const { inputs: t, backend: e } = o, { a: n, b: s } = t, a = L().getBool("WEBGL_PACK_BINARY_OPERATIONS"), r = L().getNumber("WEBGL_VERSION");
|
|
12508
12510
|
if (e.shouldExecuteOnCPU([n, s]) || r === 1) {
|
|
12509
|
-
const c = e.texData.get(n.dataId).values, l = e.texData.get(s.dataId).values, [u, p] =
|
|
12511
|
+
const c = e.texData.get(n.dataId).values, l = e.texData.get(s.dataId).values, [u, p] = yp(n.shape, s.shape, c, l, n.dtype), d = e.makeTensorInfo(p, n.dtype), h = e.texData.get(d.dataId);
|
|
12510
12512
|
return h.values = u, d;
|
|
12511
12513
|
}
|
|
12512
12514
|
let i;
|
|
@@ -12558,7 +12560,7 @@ const oy = {
|
|
|
12558
12560
|
* limitations under the License.
|
|
12559
12561
|
* =============================================================================
|
|
12560
12562
|
*/
|
|
12561
|
-
const ay = "return float(a != b);", oc = ke({ opSnippet: ay, cpuKernelImpl:
|
|
12563
|
+
const ay = "return float(a != b);", oc = ke({ opSnippet: ay, cpuKernelImpl: $p, dtype: "bool" }), ry = {
|
|
12562
12564
|
kernelName: el,
|
|
12563
12565
|
backendName: "webgl",
|
|
12564
12566
|
kernelFunc: oc
|
|
@@ -12630,7 +12632,7 @@ function Zs(o) {
|
|
|
12630
12632
|
if (a === "complex64") {
|
|
12631
12633
|
if (s.dtype === "complex64")
|
|
12632
12634
|
return Le({ inputs: { x: s }, backend: e });
|
|
12633
|
-
const r =
|
|
12635
|
+
const r = Hr(s.shape), i = Zs({ inputs: { x: s }, backend: e, attrs: { dtype: "float32" } }), c = Nt({ inputs: { real: i, imag: r }, backend: e });
|
|
12634
12636
|
return r.dispose(), e.disposeIntermediateTensorInfo(i), c;
|
|
12635
12637
|
}
|
|
12636
12638
|
if (s.dtype === "complex64") {
|
|
@@ -12642,7 +12644,7 @@ function Zs(o) {
|
|
|
12642
12644
|
return { dataId: r.dataId, shape: r.shape, dtype: a };
|
|
12643
12645
|
}
|
|
12644
12646
|
if (e.shouldExecuteOnCPU([s])) {
|
|
12645
|
-
const r = e.texData.get(s.dataId).values, [i, c, l] =
|
|
12647
|
+
const r = e.texData.get(s.dataId).values, [i, c, l] = kp(r, s.shape, s.dtype, a);
|
|
12646
12648
|
return e.makeTensorInfo(i, c, l);
|
|
12647
12649
|
}
|
|
12648
12650
|
if (a === "int32")
|
|
@@ -12674,7 +12676,7 @@ const uy = {
|
|
|
12674
12676
|
* limitations under the License.
|
|
12675
12677
|
* =============================================================================
|
|
12676
12678
|
*/
|
|
12677
|
-
const xo = "return ceil(x);", dy = ae({ opSnippet: xo, packedOpSnippet: xo, cpuKernelImpl:
|
|
12679
|
+
const xo = "return ceil(x);", dy = ae({ opSnippet: xo, packedOpSnippet: xo, cpuKernelImpl: wp }), py = {
|
|
12678
12680
|
kernelName: To,
|
|
12679
12681
|
backendName: "webgl",
|
|
12680
12682
|
kernelFunc: dy
|
|
@@ -13024,7 +13026,7 @@ function Et(o, t, e) {
|
|
|
13024
13026
|
h.map((b) => b.shape),
|
|
13025
13027
|
1
|
|
13026
13028
|
/* axis */
|
|
13027
|
-
), x = h[0].shape[0] === 1, g =
|
|
13029
|
+
), x = h[0].shape[0] === 1, g = Np(f, m, n, x), C = je(o.map((b) => b.shape), t), I = e.makeTensorInfo(C, n, g);
|
|
13028
13030
|
return h.forEach((b) => e.disposeIntermediateTensorInfo(b)), I;
|
|
13029
13031
|
}
|
|
13030
13032
|
const a = o.filter((h) => z(h.shape) > 0), r = L().getBool("WEBGL_PACK_ARRAY_OPERATIONS") && a[0].shape.length > 1;
|
|
@@ -13079,7 +13081,7 @@ function ky(o, t, e) {
|
|
|
13079
13081
|
*/
|
|
13080
13082
|
function ac(o) {
|
|
13081
13083
|
const { inputs: t, backend: e, attrs: n } = o, { axis: s } = n, a = me(s, t[0].shape)[0], r = t.map((l) => l.shape);
|
|
13082
|
-
|
|
13084
|
+
Qr(r, a);
|
|
13083
13085
|
const i = je(t.map((l) => l.shape), a);
|
|
13084
13086
|
if (z(i) === 0)
|
|
13085
13087
|
return e.makeTensorInfo(i, t[0].dtype, []);
|
|
@@ -13726,7 +13728,7 @@ function cc({ x: o, filter: t, convInfo: e, backend: n, bias: s = null, preluAct
|
|
|
13726
13728
|
shape: [1, b, e.inChannels],
|
|
13727
13729
|
dtype: o.dtype
|
|
13728
13730
|
}, $ = l.shape;
|
|
13729
|
-
l.shape = l.shape.slice(), l.shape[l.shape.length - 2]++, Y(
|
|
13731
|
+
l.shape = l.shape.slice(), l.shape[l.shape.length - 2]++, Y(ki(l.shape, y.shape), () => `packed reshape ${l.shape} to ${y.shape} isn't free`);
|
|
13730
13732
|
const k = H({
|
|
13731
13733
|
inputs: { x: t },
|
|
13732
13734
|
backend: n,
|
|
@@ -14655,10 +14657,10 @@ const n0 = {
|
|
|
14655
14657
|
function o0(o) {
|
|
14656
14658
|
const { inputs: t, backend: e, attrs: n } = o, { x: s, weights: a } = t, { size: r, binaryOutput: i } = n;
|
|
14657
14659
|
if (s.shape.length === 1) {
|
|
14658
|
-
const c = e.readSync(s.dataId), l = e.readSync(a.dataId), u =
|
|
14660
|
+
const c = e.readSync(s.dataId), l = e.readSync(a.dataId), u = vi(c, l, a.dtype, a.shape, r);
|
|
14659
14661
|
return e.makeTensorInfo([r], a.dtype, u);
|
|
14660
14662
|
} else if (s.shape.length === 2) {
|
|
14661
|
-
const c = e.bufferSync(s), l = e.bufferSync(a), u =
|
|
14663
|
+
const c = e.bufferSync(s), l = e.bufferSync(a), u = vp(c, l, r, i);
|
|
14662
14664
|
return e.makeTensorInfo(u.shape, a.dtype, u.values);
|
|
14663
14665
|
}
|
|
14664
14666
|
throw new Error(`Error in denseBincount: input must be at most rank 2, but got rank${s.shape.length}.`);
|
|
@@ -15453,16 +15455,16 @@ const $0 = {
|
|
|
15453
15455
|
* =============================================================================
|
|
15454
15456
|
*/
|
|
15455
15457
|
function k0(o) {
|
|
15456
|
-
const { inputs: t, backend: e, attrs: n } = o, { equation: s } = n, a = t, { allDims: r, summedDims: i, idDims: c } =
|
|
15457
|
-
|
|
15458
|
-
const { path: l, steps: u } =
|
|
15458
|
+
const { inputs: t, backend: e, attrs: n } = o, { equation: s } = n, a = t, { allDims: r, summedDims: i, idDims: c } = Zr(s, a.length);
|
|
15459
|
+
Jr(r.length, c, a);
|
|
15460
|
+
const { path: l, steps: u } = ei(i, c), p = u.length;
|
|
15459
15461
|
let d = null, h = r.length;
|
|
15460
15462
|
const f = [];
|
|
15461
15463
|
for (let m = 0; m < p; ++m) {
|
|
15462
15464
|
for (const x of u[m]) {
|
|
15463
|
-
const { permutationIndices: g, expandDims: C } =
|
|
15465
|
+
const { permutationIndices: g, expandDims: C } = ti(h, c[x]);
|
|
15464
15466
|
let I;
|
|
15465
|
-
|
|
15467
|
+
si(g) ? I = a[x] : (I = ve({ inputs: { x: a[x] }, backend: e, attrs: { perm: g } }), f.push(I));
|
|
15466
15468
|
const b = I.shape.slice();
|
|
15467
15469
|
for (let y = 0; y < C.length; ++y)
|
|
15468
15470
|
b.splice(C[y], 0, 1);
|
|
@@ -15565,7 +15567,7 @@ const P0 = `
|
|
|
15565
15567
|
opSnippet: O0,
|
|
15566
15568
|
packedOpSnippet: P0,
|
|
15567
15569
|
dtype: "bool",
|
|
15568
|
-
cpuKernelImpl:
|
|
15570
|
+
cpuKernelImpl: Sp
|
|
15569
15571
|
}), _0 = {
|
|
15570
15572
|
kernelName: ol,
|
|
15571
15573
|
backendName: "webgl",
|
|
@@ -15591,12 +15593,12 @@ const L0 = `
|
|
|
15591
15593
|
// Error function is calculated approximately with elementary function.
|
|
15592
15594
|
// See "Handbook of Mathematical Functions with Formulas,
|
|
15593
15595
|
// Graphs, and Mathematical Tables", Abramowitz and Stegun.
|
|
15594
|
-
float p = ${
|
|
15595
|
-
float a1 = ${
|
|
15596
|
-
float a2 = ${
|
|
15597
|
-
float a3 = ${
|
|
15598
|
-
float a4 = ${
|
|
15599
|
-
float a5 = ${
|
|
15596
|
+
float p = ${ci};
|
|
15597
|
+
float a1 = ${ii};
|
|
15598
|
+
float a2 = ${ri};
|
|
15599
|
+
float a3 = ${ai};
|
|
15600
|
+
float a4 = ${oi};
|
|
15601
|
+
float a5 = ${ni};
|
|
15600
15602
|
|
|
15601
15603
|
float sign = sign(x);
|
|
15602
15604
|
x = abs(x);
|
|
@@ -15637,7 +15639,7 @@ const M0 = vt + `
|
|
|
15637
15639
|
`, hc = ae({
|
|
15638
15640
|
opSnippet: M0,
|
|
15639
15641
|
packedOpSnippet: B0,
|
|
15640
|
-
cpuKernelImpl:
|
|
15642
|
+
cpuKernelImpl: Rp,
|
|
15641
15643
|
dtype: "float32"
|
|
15642
15644
|
}), G0 = {
|
|
15643
15645
|
kernelName: al,
|
|
@@ -15686,7 +15688,7 @@ const z0 = {
|
|
|
15686
15688
|
* limitations under the License.
|
|
15687
15689
|
* =============================================================================
|
|
15688
15690
|
*/
|
|
15689
|
-
const $o = "return exp(x) - 1.0;", U0 = ae({ opSnippet: $o, packedOpSnippet: $o, cpuKernelImpl:
|
|
15691
|
+
const $o = "return exp(x) - 1.0;", U0 = ae({ opSnippet: $o, packedOpSnippet: $o, cpuKernelImpl: Tp }), H0 = {
|
|
15690
15692
|
kernelName: Eo,
|
|
15691
15693
|
backendName: "webgl",
|
|
15692
15694
|
kernelFunc: U0
|
|
@@ -15949,7 +15951,7 @@ const Q0 = {
|
|
|
15949
15951
|
* limitations under the License.
|
|
15950
15952
|
* =============================================================================
|
|
15951
15953
|
*/
|
|
15952
|
-
const wo = "return floor(x);", Z0 = ae({ opSnippet: wo, packedOpSnippet: wo, cpuKernelImpl:
|
|
15954
|
+
const wo = "return floor(x);", Z0 = ae({ opSnippet: wo, packedOpSnippet: wo, cpuKernelImpl: Dp }), J0 = {
|
|
15953
15955
|
kernelName: rl,
|
|
15954
15956
|
backendName: "webgl",
|
|
15955
15957
|
kernelFunc: Z0
|
|
@@ -16316,13 +16318,13 @@ class p$ {
|
|
|
16316
16318
|
* =============================================================================
|
|
16317
16319
|
*/
|
|
16318
16320
|
function h$(o) {
|
|
16319
|
-
const { inputs: t, backend: e } = o, { params: n, indices: s } = t, a = s.shape, r = a[a.length - 1], i = z(n.shape), [c, l, u, p] =
|
|
16321
|
+
const { inputs: t, backend: e } = o, { params: n, indices: s } = t, a = s.shape, r = a[a.length - 1], i = z(n.shape), [c, l, u, p] = ui(n, s), d = H({ inputs: { x: s }, backend: e, attrs: { shape: [l, r] } }), h = H({
|
|
16320
16322
|
inputs: { x: n },
|
|
16321
16323
|
backend: e,
|
|
16322
16324
|
attrs: { shape: [z(n.shape) / u, u] }
|
|
16323
16325
|
});
|
|
16324
16326
|
if (e.shouldExecuteOnCPU([n, s]) || n.dtype === "string") {
|
|
16325
|
-
const g = e.readSync(s.dataId), C = e.bufferSync(n), I =
|
|
16327
|
+
const g = e.readSync(s.dataId), C = e.bufferSync(n), I = Ep(g, C, n.dtype, l, r, u, p, n.shape, i);
|
|
16326
16328
|
return e.makeTensorInfo(c, n.dtype, I.values);
|
|
16327
16329
|
}
|
|
16328
16330
|
const f = new p$(r, p, [l, u], n.shape), m = e.runWebGLProgram(f, [h, d], h.dtype), x = H({ inputs: { x: m }, backend: e, attrs: { shape: c } });
|
|
@@ -16394,7 +16396,7 @@ function mc(o) {
|
|
|
16394
16396
|
Y(y <= I - 1 && y >= 0, () => `GatherV2: the index value ${y} is not in [0, ${I - 1}]`);
|
|
16395
16397
|
}
|
|
16396
16398
|
}
|
|
16397
|
-
const l =
|
|
16399
|
+
const l = di(s, a, c, i), u = z(a.shape), p = [], d = H({
|
|
16398
16400
|
inputs: { x: s },
|
|
16399
16401
|
backend: e,
|
|
16400
16402
|
attrs: {
|
|
@@ -16418,7 +16420,7 @@ function mc(o) {
|
|
|
16418
16420
|
l.sliceSize
|
|
16419
16421
|
];
|
|
16420
16422
|
if (e.shouldExecuteOnCPU([s, a]) || s.dtype === "string") {
|
|
16421
|
-
const C = e.bufferSync(h), I = e.bufferSync(d), b =
|
|
16423
|
+
const C = e.bufferSync(h), I = e.bufferSync(d), b = Fp(I, C, f);
|
|
16422
16424
|
return p.forEach((y) => e.disposeIntermediateTensorInfo(y)), e.makeTensorInfo(l.outputShape, b.dtype, b.values);
|
|
16423
16425
|
}
|
|
16424
16426
|
const m = new m$(d.shape, f), x = e.runWebGLProgram(m, [d, h], d.dtype);
|
|
@@ -16452,7 +16454,7 @@ const C$ = "return float(a > b);", b$ = `
|
|
|
16452
16454
|
`, I$ = ke({
|
|
16453
16455
|
opSnippet: C$,
|
|
16454
16456
|
packedOpSnippet: b$,
|
|
16455
|
-
cpuKernelImpl:
|
|
16457
|
+
cpuKernelImpl: Pp,
|
|
16456
16458
|
dtype: "bool"
|
|
16457
16459
|
}), y$ = {
|
|
16458
16460
|
kernelName: ll,
|
|
@@ -16481,7 +16483,7 @@ const $$ = "return float(a >= b);", k$ = `
|
|
|
16481
16483
|
opSnippet: $$,
|
|
16482
16484
|
packedOpSnippet: k$,
|
|
16483
16485
|
dtype: "bool",
|
|
16484
|
-
cpuKernelImpl:
|
|
16486
|
+
cpuKernelImpl: Op
|
|
16485
16487
|
}), N$ = {
|
|
16486
16488
|
kernelName: ul,
|
|
16487
16489
|
backendName: "webgl",
|
|
@@ -16596,7 +16598,7 @@ const L$ = "return float(a < b);", V$ = `
|
|
|
16596
16598
|
`, W$ = ke({
|
|
16597
16599
|
opSnippet: L$,
|
|
16598
16600
|
packedOpSnippet: V$,
|
|
16599
|
-
cpuKernelImpl:
|
|
16601
|
+
cpuKernelImpl: Ap,
|
|
16600
16602
|
dtype: "bool"
|
|
16601
16603
|
}), M$ = {
|
|
16602
16604
|
kernelName: dl,
|
|
@@ -16624,7 +16626,7 @@ const B$ = "return float(a <= b);", G$ = `
|
|
|
16624
16626
|
`, z$ = ke({
|
|
16625
16627
|
opSnippet: B$,
|
|
16626
16628
|
packedOpSnippet: G$,
|
|
16627
|
-
cpuKernelImpl:
|
|
16629
|
+
cpuKernelImpl: _p,
|
|
16628
16630
|
dtype: "bool"
|
|
16629
16631
|
}), U$ = {
|
|
16630
16632
|
kernelName: pl,
|
|
@@ -16648,7 +16650,7 @@ const B$ = "return float(a <= b);", G$ = `
|
|
|
16648
16650
|
* =============================================================================
|
|
16649
16651
|
*/
|
|
16650
16652
|
function H$(o) {
|
|
16651
|
-
const { backend: t, attrs: e } = o, { start: n, stop: s, num: a } = e, r =
|
|
16653
|
+
const { backend: t, attrs: e } = o, { start: n, stop: s, num: a } = e, r = Lp(n, s, a);
|
|
16652
16654
|
return t.makeTensorInfo([r.length], "float32", r);
|
|
16653
16655
|
}
|
|
16654
16656
|
const X$ = {
|
|
@@ -16682,7 +16684,7 @@ const K$ = vt + `
|
|
|
16682
16684
|
result.b = isNaN.b ? x.b : (x.b < 0.0 ? 0./0. : result.b);
|
|
16683
16685
|
result.a = isNaN.a ? x.a : (x.a < 0.0 ? 0./0. : result.a);
|
|
16684
16686
|
return result;
|
|
16685
|
-
`, j$ = ae({ opSnippet: K$, packedOpSnippet: q$, cpuKernelImpl:
|
|
16687
|
+
`, j$ = ae({ opSnippet: K$, packedOpSnippet: q$, cpuKernelImpl: Vp }), Y$ = {
|
|
16686
16688
|
kernelName: hl,
|
|
16687
16689
|
backendName: "webgl",
|
|
16688
16690
|
kernelFunc: j$
|
|
@@ -17071,7 +17073,7 @@ const Ck = Wn + `
|
|
|
17071
17073
|
`, Ik = ke({
|
|
17072
17074
|
opSnippet: Ck,
|
|
17073
17075
|
packedOpSnippet: bk,
|
|
17074
|
-
cpuKernelImpl:
|
|
17076
|
+
cpuKernelImpl: Wp
|
|
17075
17077
|
}), yk = {
|
|
17076
17078
|
kernelName: fl,
|
|
17077
17079
|
backendName: "webgl",
|
|
@@ -17431,7 +17433,7 @@ const Ak = {
|
|
|
17431
17433
|
const b = r.texData.get(f.dataId).values, y = new Array(i);
|
|
17432
17434
|
for (let w = 0; w < y.length; w++)
|
|
17433
17435
|
y[w] = n.shape[u[w]];
|
|
17434
|
-
const $ =
|
|
17436
|
+
const $ = Ni(b, n.shape, n.dtype, u, y);
|
|
17435
17437
|
f = r.makeTensorInfo(y, n.dtype);
|
|
17436
17438
|
const k = r.texData.get(f.dataId);
|
|
17437
17439
|
k.values = $;
|
|
@@ -17513,7 +17515,7 @@ const Vk = Wn + `
|
|
|
17513
17515
|
`, Mk = ke({
|
|
17514
17516
|
opSnippet: Vk,
|
|
17515
17517
|
packedOpSnippet: Wk,
|
|
17516
|
-
cpuKernelImpl:
|
|
17518
|
+
cpuKernelImpl: Mp
|
|
17517
17519
|
}), Bk = {
|
|
17518
17520
|
kernelName: ml,
|
|
17519
17521
|
backendName: "webgl",
|
|
@@ -17783,7 +17785,7 @@ const No = "return a - b;", gc = ke({
|
|
|
17783
17785
|
opSnippet: No,
|
|
17784
17786
|
packedOpSnippet: No,
|
|
17785
17787
|
supportsComplex: !0,
|
|
17786
|
-
cpuKernelImpl:
|
|
17788
|
+
cpuKernelImpl: Bp
|
|
17787
17789
|
}), Qk = {
|
|
17788
17790
|
kernelName: gl,
|
|
17789
17791
|
backendName: "webgl",
|
|
@@ -17875,7 +17877,7 @@ const tw = Ue + `
|
|
|
17875
17877
|
function nw(o) {
|
|
17876
17878
|
const { inputs: t, backend: e } = o, { x: n } = t;
|
|
17877
17879
|
if (e.shouldExecuteOnCPU([n])) {
|
|
17878
|
-
const a = e.texData.get(n.dataId), [r, i] =
|
|
17880
|
+
const a = e.texData.get(n.dataId), [r, i] = Gp(a.values, n.shape, n.dtype);
|
|
17879
17881
|
return e.makeTensorInfo(i, n.dtype, r);
|
|
17880
17882
|
}
|
|
17881
17883
|
let s;
|
|
@@ -17902,7 +17904,7 @@ const ow = {
|
|
|
17902
17904
|
* limitations under the License.
|
|
17903
17905
|
* =============================================================================
|
|
17904
17906
|
*/
|
|
17905
|
-
const aw =
|
|
17907
|
+
const aw = mi;
|
|
17906
17908
|
function rw(o) {
|
|
17907
17909
|
Vt("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");
|
|
17908
17910
|
const { inputs: t, backend: e, attrs: n } = o, { boxes: s, scores: a } = t, { maxOutputSize: r, iouThreshold: i, scoreThreshold: c } = n, l = e.readSync(s.dataId), u = e.readSync(a.dataId), { selectedIndices: p } = aw(l, u, r, i, c);
|
|
@@ -17929,7 +17931,7 @@ const iw = {
|
|
|
17929
17931
|
* limitations under the License.
|
|
17930
17932
|
* =============================================================================
|
|
17931
17933
|
*/
|
|
17932
|
-
const cw =
|
|
17934
|
+
const cw = gi;
|
|
17933
17935
|
function lw(o) {
|
|
17934
17936
|
Vt("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");
|
|
17935
17937
|
const { inputs: t, backend: e, attrs: n } = o, { boxes: s, scores: a } = t, { maxOutputSize: r, iouThreshold: i, scoreThreshold: c, padToMaxOutputSize: l } = n, u = e.readSync(s.dataId), p = e.readSync(a.dataId), { selectedIndices: d, validOutputs: h } = cw(u, p, r, i, c, l);
|
|
@@ -17959,7 +17961,7 @@ const uw = {
|
|
|
17959
17961
|
* limitations under the License.
|
|
17960
17962
|
* =============================================================================
|
|
17961
17963
|
*/
|
|
17962
|
-
const dw =
|
|
17964
|
+
const dw = xi;
|
|
17963
17965
|
function pw(o) {
|
|
17964
17966
|
Vt("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");
|
|
17965
17967
|
const { inputs: t, backend: e, attrs: n } = o, { boxes: s, scores: a } = t, { maxOutputSize: r, iouThreshold: i, scoreThreshold: c, softNmsSigma: l } = n, u = e.readSync(s.dataId), p = e.readSync(a.dataId), d = r, h = i, f = c, m = l, { selectedIndices: x, selectedScores: g } = dw(u, p, d, h, f, m);
|
|
@@ -18349,7 +18351,7 @@ function Rw(o) {
|
|
|
18349
18351
|
p != null && (d = ve({ inputs: { x: s }, backend: e, attrs: { perm: p } }), u = $e(u.length, i), c.push(d)), Re("prod", u, i);
|
|
18350
18352
|
let h;
|
|
18351
18353
|
if (e.shouldExecuteOnCPU([d])) {
|
|
18352
|
-
const f = e.texData.get(d.dataId).values, { outVals: m, outShape: x, outDtype: g } =
|
|
18354
|
+
const f = e.texData.get(d.dataId).values, { outVals: m, outShape: x, outDtype: g } = zp(d.shape, d.dtype, f, u);
|
|
18353
18355
|
h = e.makeTensorInfo(x, g, m);
|
|
18354
18356
|
} else {
|
|
18355
18357
|
const [f, m] = Ee(d.shape, u), x = z(m), g = H({ inputs: { x: d }, backend: e, attrs: { shape: [-1, x] } }), C = Tr(s.dtype), I = zt(g, C, "prod", e);
|
|
@@ -18384,7 +18386,7 @@ const Tw = {
|
|
|
18384
18386
|
* =============================================================================
|
|
18385
18387
|
*/
|
|
18386
18388
|
function Dw(o) {
|
|
18387
|
-
const { inputs: t, backend: e, attrs: n } = o, { paramsNestedSplits: s, paramsDenseValues: a, indices: r } = t, { outputRaggedRank: i } = n, c = s.map((g) => e.readSync(g.dataId)), l = s.map((g) => g.shape), u = e.readSync(a.dataId), p = e.readSync(r.dataId), [d, h, f] =
|
|
18389
|
+
const { inputs: t, backend: e, attrs: n } = o, { paramsNestedSplits: s, paramsDenseValues: a, indices: r } = t, { outputRaggedRank: i } = n, c = s.map((g) => e.readSync(g.dataId)), l = s.map((g) => g.shape), u = e.readSync(a.dataId), p = e.readSync(r.dataId), [d, h, f] = Up(c, l, u, a.shape, a.dtype, p, r.shape, i), m = d.map((g) => e.makeTensorInfo([g.length], "int32", g)), x = e.makeTensorInfo(f, a.dtype, h);
|
|
18388
18390
|
return m.concat([x]);
|
|
18389
18391
|
}
|
|
18390
18392
|
const Ew = {
|
|
@@ -18409,7 +18411,7 @@ const Ew = {
|
|
|
18409
18411
|
* =============================================================================
|
|
18410
18412
|
*/
|
|
18411
18413
|
function Fw(o) {
|
|
18412
|
-
const { inputs: t, backend: e } = o, { starts: n, limits: s, deltas: a } = t, r = e.readSync(n.dataId), i = e.readSync(s.dataId), c = e.readSync(a.dataId), [l, u] =
|
|
18414
|
+
const { inputs: t, backend: e } = o, { starts: n, limits: s, deltas: a } = t, r = e.readSync(n.dataId), i = e.readSync(s.dataId), c = e.readSync(a.dataId), [l, u] = Hp(r, n.shape, n.dtype, i, s.shape, c, a.shape), p = e.makeTensorInfo([l.length], "int32", l), d = e.makeTensorInfo([u.length], n.dtype, u);
|
|
18413
18415
|
return [p, d];
|
|
18414
18416
|
}
|
|
18415
18417
|
const Pw = {
|
|
@@ -18434,7 +18436,7 @@ const Pw = {
|
|
|
18434
18436
|
* =============================================================================
|
|
18435
18437
|
*/
|
|
18436
18438
|
function Ow(o) {
|
|
18437
|
-
const { inputs: t, backend: e, attrs: n } = o, { shape: s, values: a, defaultValue: r, rowPartitionTensors: i } = t, { rowPartitionTypes: c } = n, l = e.readSync(s.dataId), u = e.readSync(a.dataId), p = e.readSync(r.dataId), d = i.map((x) => e.readSync(x.dataId)), h = i.map((x) => x.shape), [f, m] =
|
|
18439
|
+
const { inputs: t, backend: e, attrs: n } = o, { shape: s, values: a, defaultValue: r, rowPartitionTensors: i } = t, { rowPartitionTypes: c } = n, l = e.readSync(s.dataId), u = e.readSync(a.dataId), p = e.readSync(r.dataId), d = i.map((x) => e.readSync(x.dataId)), h = i.map((x) => x.shape), [f, m] = Xp(l, s.shape, u, a.shape, a.dtype, p, r.shape, d, h, c);
|
|
18438
18440
|
return e.makeTensorInfo(f, a.dtype, m);
|
|
18439
18441
|
}
|
|
18440
18442
|
const Aw = {
|
|
@@ -18459,7 +18461,7 @@ const Aw = {
|
|
|
18459
18461
|
* =============================================================================
|
|
18460
18462
|
*/
|
|
18461
18463
|
const Ic = (o) => {
|
|
18462
|
-
const { backend: t, attrs: e } = o, { start: n, stop: s, step: a, dtype: r } = e, i =
|
|
18464
|
+
const { backend: t, attrs: e } = o, { start: n, stop: s, step: a, dtype: r } = e, i = Kp(n, s, a, r);
|
|
18463
18465
|
return t.makeTensorInfo([i.length], r, i);
|
|
18464
18466
|
}, _w = {
|
|
18465
18467
|
kernelName: er,
|
|
@@ -19369,7 +19371,7 @@ const hN = {
|
|
|
19369
19371
|
kernelName: rr,
|
|
19370
19372
|
backendName: "webgl",
|
|
19371
19373
|
kernelFunc: ({ inputs: o, attrs: t, backend: e }) => {
|
|
19372
|
-
const { image: n } = o, { radians: s, fillValue: a, center: r } = t, i = e, c = new pN(n.shape, a), [l, u] =
|
|
19374
|
+
const { image: n } = o, { radians: s, fillValue: a, center: r } = t, i = e, c = new pN(n.shape, a), [l, u] = pi(r, n.shape[1], n.shape[2]), p = [[l, u, Math.sin(s), Math.cos(s)]];
|
|
19373
19375
|
return i.runWebGLProgram(c, [n], n.dtype, p);
|
|
19374
19376
|
}
|
|
19375
19377
|
};
|
|
@@ -19425,7 +19427,7 @@ const fN = `
|
|
|
19425
19427
|
* limitations under the License.
|
|
19426
19428
|
* =============================================================================
|
|
19427
19429
|
*/
|
|
19428
|
-
const xN = "return inversesqrt(x);", CN = ae({ opSnippet: xN, cpuKernelImpl:
|
|
19430
|
+
const xN = "return inversesqrt(x);", CN = ae({ opSnippet: xN, cpuKernelImpl: qp }), bN = {
|
|
19429
19431
|
kernelName: Cl,
|
|
19430
19432
|
backendName: "webgl",
|
|
19431
19433
|
kernelFunc: CN
|
|
@@ -19743,8 +19745,8 @@ const RN = {
|
|
|
19743
19745
|
const TN = `
|
|
19744
19746
|
// Stable and Attracting Fixed Point (0, 1) for Normalized Weights.
|
|
19745
19747
|
// see: https://arxiv.org/abs/1706.02515
|
|
19746
|
-
float scaleAlpha = ${
|
|
19747
|
-
float scale = ${
|
|
19748
|
+
float scaleAlpha = ${Gr};
|
|
19749
|
+
float scale = ${Br};
|
|
19748
19750
|
return (x >= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0);
|
|
19749
19751
|
`, DN = ae({ opSnippet: TN }), EN = {
|
|
19750
19752
|
kernelName: Sn,
|
|
@@ -19782,7 +19784,7 @@ const FN = vt + `
|
|
|
19782
19784
|
`, ON = ae({
|
|
19783
19785
|
opSnippet: FN,
|
|
19784
19786
|
packedOpSnippet: PN,
|
|
19785
|
-
cpuKernelImpl:
|
|
19787
|
+
cpuKernelImpl: jp
|
|
19786
19788
|
}), AN = {
|
|
19787
19789
|
kernelName: bl,
|
|
19788
19790
|
backendName: "webgl",
|
|
@@ -19973,7 +19975,7 @@ function QN(o) {
|
|
|
19973
19975
|
if (r.shape.length !== 0)
|
|
19974
19976
|
throw new Error(`Default value must be a scalar, saw:
|
|
19975
19977
|
${r.shape}`);
|
|
19976
|
-
const i = e.readSync(n.dataId), c = e.readSync(s.dataId), l = e.readSync(a.dataId), u = e.readSync(r.dataId)[0], [p, d, h, f, m] =
|
|
19978
|
+
const i = e.readSync(n.dataId), c = e.readSync(s.dataId), l = e.readSync(a.dataId), u = e.readSync(r.dataId)[0], [p, d, h, f, m] = Yp(i, n.shape, n.dtype, c, s.dtype, l, u);
|
|
19977
19979
|
return [
|
|
19978
19980
|
e.makeTensorInfo(d, n.dtype, p),
|
|
19979
19981
|
e.makeTensorInfo([d[0]], s.dtype, h),
|
|
@@ -20010,7 +20012,7 @@ function JN(o) {
|
|
|
20010
20012
|
throw new Error(`Input shape should be a vector but received shape ${s.shape}`);
|
|
20011
20013
|
if (a.shape.length !== 1)
|
|
20012
20014
|
throw new Error(`Target shape should be a vector but received shape ${a.shape}`);
|
|
20013
|
-
const r = Array.from(e.readSync(s.dataId)), i = e.readSync(n.dataId), c = Array.from(e.readSync(a.dataId)), [l, u, p] =
|
|
20015
|
+
const r = Array.from(e.readSync(s.dataId)), i = e.readSync(n.dataId), c = Array.from(e.readSync(a.dataId)), [l, u, p] = Qp(i, n.shape, n.dtype, r, c);
|
|
20014
20016
|
return [
|
|
20015
20017
|
e.makeTensorInfo(u, n.dtype, l),
|
|
20016
20018
|
e.makeTensorInfo([p.length], a.dtype, new Int32Array(p))
|
|
@@ -20047,7 +20049,7 @@ function tv(o) {
|
|
|
20047
20049
|
if (a.shape.length !== 1)
|
|
20048
20050
|
throw new Error(`Segment ids should be a vector but received shape
|
|
20049
20051
|
${a.shape}`);
|
|
20050
|
-
const r = e.readSync(n.dataId), i = e.readSync(s.dataId), c = e.readSync(a.dataId), [l, u] =
|
|
20052
|
+
const r = e.readSync(n.dataId), i = e.readSync(s.dataId), c = e.readSync(a.dataId), [l, u] = Si(r, n.shape, n.dtype, i, c, !0);
|
|
20051
20053
|
return e.makeTensorInfo(u, n.dtype, l);
|
|
20052
20054
|
}
|
|
20053
20055
|
const sv = {
|
|
@@ -20081,7 +20083,7 @@ function nv(o) {
|
|
|
20081
20083
|
if (a.shape.length !== 1)
|
|
20082
20084
|
throw new Error(`Segment ids should be a vector but received shape
|
|
20083
20085
|
${a.shape}`);
|
|
20084
|
-
const r = e.readSync(n.dataId), i = e.readSync(s.dataId), c = e.readSync(a.dataId), [l, u] =
|
|
20086
|
+
const r = e.readSync(n.dataId), i = e.readSync(s.dataId), c = e.readSync(a.dataId), [l, u] = Si(r, n.shape, n.dtype, i, c);
|
|
20085
20087
|
return e.makeTensorInfo(u, n.dtype, l);
|
|
20086
20088
|
}
|
|
20087
20089
|
const ov = {
|
|
@@ -20108,7 +20110,7 @@ const ov = {
|
|
|
20108
20110
|
function av(o) {
|
|
20109
20111
|
const { inputs: t, backend: e, attrs: n } = o, { sparseIndices: s, sparseValues: a, defaultValue: r } = t, { outputShape: i } = n, { sliceRank: c, numUpdates: l, sliceSize: u, strides: p, outputSize: d } = wt(a, s, i), h = !1;
|
|
20110
20112
|
if (a.dtype === "string") {
|
|
20111
|
-
const g = e.bufferSync(s), C = e.bufferSync(a), I = Wt(e.readSync(r.dataId)[0]), b =
|
|
20113
|
+
const g = e.bufferSync(s), C = e.bufferSync(a), I = Wt(e.readSync(r.dataId)[0]), b = Zp(g, C, i, d, u, l, c, p, I, h);
|
|
20112
20114
|
return e.makeTensorInfo(i, b.dtype, b.values);
|
|
20113
20115
|
}
|
|
20114
20116
|
const f = new Xn(l, c, s.shape.length, a.shape.length, p, [d, 1], h), m = e.runWebGLProgram(f, [a, s, r], a.dtype), x = H({ inputs: { x: m }, backend: e, attrs: { shape: i } });
|
|
@@ -20136,7 +20138,7 @@ const rv = {
|
|
|
20136
20138
|
* =============================================================================
|
|
20137
20139
|
*/
|
|
20138
20140
|
function iv(o) {
|
|
20139
|
-
const { inputs: t, backend: e, attrs: n } = o, { x: s } = t, { numOrSizeSplits: a, axis: r } = n, i = me(r, s.shape)[0], c =
|
|
20141
|
+
const { inputs: t, backend: e, attrs: n } = o, { x: s } = t, { numOrSizeSplits: a, axis: r } = n, i = me(r, s.shape)[0], c = hi(s, a, i), l = s.shape.length, u = new Array(l).fill(0), p = s.shape.slice();
|
|
20140
20142
|
return c.map((d) => {
|
|
20141
20143
|
const h = [...p];
|
|
20142
20144
|
h[i] = d;
|
|
@@ -20165,7 +20167,7 @@ const cv = {
|
|
|
20165
20167
|
* limitations under the License.
|
|
20166
20168
|
* =============================================================================
|
|
20167
20169
|
*/
|
|
20168
|
-
const vo = "return sqrt(x);", lv = ae({ opSnippet: vo, packedOpSnippet: vo, cpuKernelImpl:
|
|
20170
|
+
const vo = "return sqrt(x);", lv = ae({ opSnippet: vo, packedOpSnippet: vo, cpuKernelImpl: Jp }), uv = {
|
|
20169
20171
|
kernelName: Il,
|
|
20170
20172
|
backendName: "webgl",
|
|
20171
20173
|
kernelFunc: lv
|
|
@@ -20232,7 +20234,7 @@ function gv(o) {
|
|
|
20232
20234
|
const { inputs: t, backend: e, attrs: n } = o, { x: s } = t;
|
|
20233
20235
|
if (s.dtype !== "string")
|
|
20234
20236
|
throw new Error("Input must be of datatype string");
|
|
20235
|
-
const a = e.readSync(s.dataId), r =
|
|
20237
|
+
const a = e.readSync(s.dataId), r = Md(a), i = eh(r, "string", n);
|
|
20236
20238
|
return e.makeTensorInfo(s.shape, "string", i);
|
|
20237
20239
|
}
|
|
20238
20240
|
const xv = {
|
|
@@ -20322,16 +20324,16 @@ class Iv {
|
|
|
20322
20324
|
* =============================================================================
|
|
20323
20325
|
*/
|
|
20324
20326
|
function yv(o) {
|
|
20325
|
-
const { inputs: t, backend: e, attrs: n } = o, { x: s } = t, { begin: a, end: r, strides: i, beginMask: c, endMask: l, ellipsisMask: u, newAxisMask: p, shrinkAxisMask: d } = n, { finalShapeSparse: h, finalShape: f, isIdentity: m, sliceDim0: x, isSimpleSlice: g, begin: C, end: I, strides: b } =
|
|
20327
|
+
const { inputs: t, backend: e, attrs: n } = o, { x: s } = t, { begin: a, end: r, strides: i, beginMask: c, endMask: l, ellipsisMask: u, newAxisMask: p, shrinkAxisMask: d } = n, { finalShapeSparse: h, finalShape: f, isIdentity: m, sliceDim0: x, isSimpleSlice: g, begin: C, end: I, strides: b } = zr(s.shape, a, r, i, c, l, u, p, d);
|
|
20326
20328
|
let y;
|
|
20327
20329
|
if (m)
|
|
20328
20330
|
y = H({ inputs: { x: s }, backend: e, attrs: { shape: f } });
|
|
20329
20331
|
else if (x || g) {
|
|
20330
20332
|
Y(s.shape.length >= 1, () => `Input must have rank at least 1, got: ${s.shape.length}`);
|
|
20331
|
-
const k =
|
|
20333
|
+
const k = Ur(C, I, b), w = St({ inputs: { x: s }, backend: e, attrs: { begin: C, size: k } });
|
|
20332
20334
|
y = H({ inputs: { x: w }, backend: e, attrs: { shape: f } }), e.disposeIntermediateTensorInfo(w);
|
|
20333
20335
|
} else if (e.shouldExecuteOnCPU([s])) {
|
|
20334
|
-
const w = e.readSync(s.dataId), v = xe(s.shape, s.dtype, w), N =
|
|
20336
|
+
const w = e.readSync(s.dataId), v = xe(s.shape, s.dtype, w), N = th(h, v, b, C);
|
|
20335
20337
|
y = e.makeTensorInfo(f, s.dtype, N.values);
|
|
20336
20338
|
} else {
|
|
20337
20339
|
const w = new Iv(C, b, h);
|
|
@@ -20362,7 +20364,7 @@ const $v = {
|
|
|
20362
20364
|
* =============================================================================
|
|
20363
20365
|
*/
|
|
20364
20366
|
function kv(o) {
|
|
20365
|
-
const { inputs: t, backend: e, attrs: n } = o, { separator: s, nGramWidths: a, leftPad: r, rightPad: i, padWidth: c, preserveShortSequences: l } = n, { data: u, dataSplits: p } = t, d = e.readSync(u.dataId), h = e.readSync(p.dataId), [f, m] =
|
|
20367
|
+
const { inputs: t, backend: e, attrs: n } = o, { separator: s, nGramWidths: a, leftPad: r, rightPad: i, padWidth: c, preserveShortSequences: l } = n, { data: u, dataSplits: p } = t, d = e.readSync(u.dataId), h = e.readSync(p.dataId), [f, m] = sh(d, h, s, a, r, i, c, l);
|
|
20366
20368
|
return [
|
|
20367
20369
|
e.makeTensorInfo([f.length], "string", f),
|
|
20368
20370
|
e.makeTensorInfo(p.shape, "int32", m)
|
|
@@ -20397,7 +20399,7 @@ function Nv(o) {
|
|
|
20397
20399
|
throw new Error(`Input must be a vector, got shape: ${a.shape}`);
|
|
20398
20400
|
if (r.shape.length !== 0)
|
|
20399
20401
|
throw new Error(`Delimiter must be a scalar, got shape: ${r.shape}`);
|
|
20400
|
-
const i = e.readSync(a.dataId), c = e.readSync(r.dataId)[0], [l, u, p] =
|
|
20402
|
+
const i = e.readSync(a.dataId), c = e.readSync(r.dataId)[0], [l, u, p] = nh(i, c, s), d = u.length;
|
|
20401
20403
|
return [
|
|
20402
20404
|
e.makeTensorInfo([d, 2], "int32", l),
|
|
20403
20405
|
e.makeTensorInfo([d], "string", u),
|
|
@@ -20431,7 +20433,7 @@ function Sv(o) {
|
|
|
20431
20433
|
throw new Error("Input must be of datatype string");
|
|
20432
20434
|
if (s <= 0)
|
|
20433
20435
|
throw new Error("Number of buckets must be at least 1");
|
|
20434
|
-
const r = e.readSync(a.dataId), i =
|
|
20436
|
+
const r = e.readSync(a.dataId), i = oh(r, s);
|
|
20435
20437
|
return e.makeTensorInfo(a.shape, "int32", i);
|
|
20436
20438
|
}
|
|
20437
20439
|
const Rv = {
|
|
@@ -20574,7 +20576,7 @@ function Vv(o) {
|
|
|
20574
20576
|
function yc(o) {
|
|
20575
20577
|
const { inputs: t, backend: e, attrs: n } = o, { x: s } = t, { reps: a } = n;
|
|
20576
20578
|
if (s.dtype === "string" || s.shape.length > 5) {
|
|
20577
|
-
const c = e.readSync(s.dataId), l = s.dtype === "string" ? c.map((d) => Wt(d)) : c, u = xe(s.shape, s.dtype, l), p =
|
|
20579
|
+
const c = e.readSync(s.dataId), l = s.dtype === "string" ? c.map((d) => Wt(d)) : c, u = xe(s.shape, s.dtype, l), p = ah(u, a);
|
|
20578
20580
|
return e.makeTensorInfo(p.shape, p.dtype, p.values);
|
|
20579
20581
|
}
|
|
20580
20582
|
const r = new Lv(s.shape, a);
|
|
@@ -20714,7 +20716,7 @@ function Ro(o) {
|
|
|
20714
20716
|
function Gv(o) {
|
|
20715
20717
|
const { inputs: t, backend: e, attrs: n } = o, { x: s } = t, { k: a, sorted: r } = n, i = L().getNumber("TOPK_LAST_DIM_CPU_HANDOFF_SIZE_THRESHOLD"), c = L().getNumber("TOPK_K_CPU_HANDOFF_THRESHOLD"), l = s.shape, u = l[l.length - 1];
|
|
20716
20718
|
if (e.shouldExecuteOnCPU([s]) || u < i || a > c) {
|
|
20717
|
-
const N = e.readSync(s.dataId), [P, O] =
|
|
20719
|
+
const N = e.readSync(s.dataId), [P, O] = rh(N, l, s.dtype, a, r);
|
|
20718
20720
|
return [
|
|
20719
20721
|
e.makeTensorInfo(P.shape, P.dtype, P.values),
|
|
20720
20722
|
e.makeTensorInfo(O.shape, O.dtype, O.values)
|
|
@@ -20966,7 +20968,7 @@ const Xv = {
|
|
|
20966
20968
|
function Kv(o) {
|
|
20967
20969
|
const { inputs: t, attrs: e, backend: n } = o, { axis: s } = e, { x: a } = t;
|
|
20968
20970
|
Gt(a, "unique"), console.warn("WARNING: ", "UI might be locked temporarily as data is being downloaded");
|
|
20969
|
-
const r = n.readSync(a.dataId), { outputValues: i, outputShape: c, indices: l } =
|
|
20971
|
+
const r = n.readSync(a.dataId), { outputValues: i, outputShape: c, indices: l } = ih(r, s, a.shape, a.dtype);
|
|
20970
20972
|
return [
|
|
20971
20973
|
n.makeTensorInfo(c, a.dtype, i),
|
|
20972
20974
|
n.makeTensorInfo([l.length], "int32", l)
|
|
@@ -21172,10 +21174,10 @@ function Zv(o) {
|
|
|
21172
21174
|
const u = ye([l], i);
|
|
21173
21175
|
let p = s;
|
|
21174
21176
|
u != null && (p = ve({ inputs: { x: s }, backend: e, attrs: { perm: u } }), c.push(p), l = $e(1, i)[0]);
|
|
21175
|
-
const d =
|
|
21177
|
+
const d = Bd(p.shape, l, r), h = z([p.shape[l]]), f = H({ inputs: { x: p }, backend: e, attrs: { shape: [-1, h] } });
|
|
21176
21178
|
c.push(f);
|
|
21177
21179
|
const m = Tr(s.dtype), x = (b, y, $, k, w) => {
|
|
21178
|
-
const v = b.shape[0], N = b.shape[1], P =
|
|
21180
|
+
const v = b.shape[0], N = b.shape[1], P = Gd(N, w), O = { windowSize: P, inSize: N, batchSize: v, numSegments: w }, E = new Qv(O, y), F = e.compileAndRun(E, [b, $], k);
|
|
21179
21181
|
if (c.push(F), F.shape[1] === w)
|
|
21180
21182
|
return F;
|
|
21181
21183
|
const T = Ic({
|