@genai-fi/nanogpt 0.6.3 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Generator.js +17 -13
- package/dist/NanoGPTModel.d.ts +2 -2
- package/dist/NanoGPTModel.js +104 -136
- package/dist/{RealDiv-BYViZwhN.js → RealDiv-CVYNbZxu.js} +30 -29
- package/dist/{Reshape-t7Kcikjk.js → Reshape-CEsEp0AI.js} +5 -5
- package/dist/Reshape-Do18N3gO.js +30 -0
- package/dist/TeachableLLM.js +9 -5
- package/dist/{TiedEmbedding-9WeDwvjO.js → TiedEmbedding-ccLBFiZi.js} +4 -4
- package/dist/{axis_util-Bu4h7XWV.js → axis_util-5DTW2tFV.js} +3 -3
- package/dist/backend.d.ts +1 -0
- package/dist/backend.js +7 -0
- package/dist/backend_util-C9Ut8n0Q.js +749 -0
- package/dist/{broadcast_to-DARN-DBD.js → broadcast_to-Ba9h_8DO.js} +2 -2
- package/dist/{concat-5aPGqw3Z.js → concat-CbXTetof.js} +8 -8
- package/dist/{dataset-pgqp-YfL.js → dataset-U3PrjwgU.js} +7 -7
- package/dist/{dropout-Bciw46HT.js → dropout-DPfPgWWe.js} +8 -8
- package/dist/{gather-DjyCjmOD.js → gather-Bbh8DHhM.js} +1 -1
- package/dist/gelu-BFwVnd1r.js +26 -0
- package/dist/gpgpu_math-DffelNS-.js +2371 -0
- package/dist/index-DYD_yPa-.js +12076 -0
- package/dist/{index-BAzbokzv.js → index-UdZhlibC.js} +414 -398
- package/dist/{kernel_funcs_utils-CUxJCg0g.js → kernel_funcs_utils-CXDy3EN7.js} +31 -30
- package/dist/layers/BaseLayer.js +2 -2
- package/dist/layers/CausalSelfAttention.js +8 -8
- 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 +11 -7
- package/dist/{log_sum_exp-YEo2h3gb.js → log_sum_exp-BnmCkHWl.js} +16 -16
- package/dist/main.d.ts +13 -0
- package/dist/main.js +44 -23
- package/dist/{mat_mul-7121rsJk.js → mat_mul-dwmZz69e.js} +4 -4
- package/dist/{max-DtlIuVeW.js → max-ByjEGoFx.js} +3 -3
- package/dist/{mulmat_packed_gpu-D4nKF7Je.js → mulmat_packed_gpu-IGPBp6h9.js} +1 -1
- package/dist/non_max_suppression_impl-CsEgBuMA.js +134 -0
- package/dist/{ones-BBlSRqn1.js → ones-C8Mfln6-.js} +2 -2
- package/dist/ops/adamAdjust.d.ts +2 -0
- package/dist/ops/adamAdjust.js +9 -0
- package/dist/ops/adamMoments.d.ts +2 -0
- package/dist/ops/adamMoments.js +9 -0
- package/dist/ops/appendCache.js +3 -3
- package/dist/ops/attentionMask.js +1 -1
- package/dist/ops/cpu/adamAdjust.d.ts +1 -0
- package/dist/ops/cpu/adamAdjust.js +18 -0
- package/dist/ops/cpu/adamMoments.d.ts +1 -0
- package/dist/ops/cpu/adamMoments.js +16 -0
- 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/adamAdjust.d.ts +1 -0
- package/dist/ops/webgl/adamAdjust.js +50 -0
- package/dist/ops/webgl/adamMoments.d.ts +1 -0
- package/dist/ops/webgl/adamMoments.js +38 -0
- 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 +8 -8
- 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/adamAdjust.d.ts +1 -0
- package/dist/ops/webgpu/adamAdjust.js +52 -0
- package/dist/ops/webgpu/adamMoments.d.ts +1 -0
- package/dist/ops/webgpu/adamMoments.js +51 -0
- package/dist/ops/webgpu/appendCache.d.ts +1 -0
- package/dist/ops/webgpu/appendCache.js +57 -0
- package/dist/ops/webgpu/attentionMask.d.ts +1 -0
- package/dist/ops/webgpu/attentionMask.js +65 -0
- package/dist/ops/webgpu/gatherSub.d.ts +1 -0
- package/dist/ops/webgpu/gatherSub.js +52 -0
- package/dist/ops/webgpu/gelu.d.ts +14 -0
- package/dist/ops/webgpu/gelu.js +87 -0
- package/dist/ops/webgpu/index.d.ts +0 -0
- package/dist/ops/webgpu/index.js +11 -0
- package/dist/ops/webgpu/normRMS.d.ts +1 -0
- package/dist/ops/webgpu/normRMS.js +41 -0
- package/dist/ops/webgpu/normRMSGrad.d.ts +1 -0
- package/dist/ops/webgpu/normRMSGrad.js +128 -0
- package/dist/ops/webgpu/qkv.d.ts +1 -0
- package/dist/ops/webgpu/qkv.js +57 -0
- package/dist/ops/webgpu/rope.d.ts +1 -0
- package/dist/ops/webgpu/rope.js +69 -0
- package/dist/ops/webgpu/scatterSub.d.ts +1 -0
- package/dist/ops/webgpu/scatterSub.js +38 -0
- package/dist/ops/webgpu/utils/reductions.d.ts +9 -0
- package/dist/ops/webgpu/utils/reductions.js +68 -0
- package/dist/{ops-C0sQEcPw.js → ops-aRTXR2Sr.js} +433 -508
- package/dist/{random_width-DWzaOgrn.js → random_width-DbSpgl4o.js} +144 -144
- package/dist/{range-DYsrnfiy.js → range-D9CZhVlR.js} +1 -1
- package/dist/{reciprocal-CJQeasVa.js → reciprocal-CGB48wZB.js} +1 -1
- package/dist/{register_all_kernels-BfFCQAqs.js → register_all_kernels-DnbAyBXt.js} +203 -200
- package/dist/{reshape-krWGKraP.js → reshape-BR0eoLYN.js} +1 -1
- package/dist/{scatter_nd_util-93ln7Hut.js → scatter_nd_util-OjyAxku2.js} +3 -3
- package/dist/{selu_util-sntGesxr.js → selu_util-Ce6pu9IM.js} +44 -44
- package/dist/{shared-Ca6iDobD.js → shared-Czipaeb6.js} +541 -606
- package/dist/shared-DS5waSIY.js +69 -0
- package/dist/{sin-D_h-qCSx.js → sin-CiBxrDqX.js} +1 -1
- package/dist/slice-BHbDHObE.js +28 -0
- package/dist/{softmax-fsdtf6JC.js → softmax-JMEIUo2J.js} +1 -1
- package/dist/{split-eiktj-6L.js → split-CRU0PjVV.js} +4 -4
- package/dist/{stack-dfEEz2OY.js → stack-ikk2Y8_P.js} +2 -2
- package/dist/{sum-BE_Irnim.js → sum-NLYbiDag.js} +3 -3
- package/dist/{tensor-Xyi595sG.js → tensor-Do9PKbIE.js} +1 -1
- package/dist/{tensor2d-CPEkynbH.js → tensor2d-CWHxHpLh.js} +1 -1
- package/dist/training/Adam.d.ts +22 -0
- package/dist/training/Adam.js +93 -0
- package/dist/training/AdamExt.d.ts +1 -1
- package/dist/training/AdamExt.js +13 -12
- package/dist/training/DatasetBuilder.js +2 -2
- package/dist/training/Evaluator.js +1 -1
- package/dist/training/FullTrainer.js +27 -27
- package/dist/training/Trainer.d.ts +5 -6
- package/dist/training/Trainer.js +54 -55
- package/dist/training/sparseCrossEntropy.d.ts +0 -4
- package/dist/training/sparseCrossEntropy.js +7 -7
- package/dist/utilities/arrayClose.d.ts +1 -0
- package/dist/utilities/arrayClose.js +11 -0
- 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-BTBkayv_.js} +1 -1
- package/dist/webgpu_program-WaoMq-WD.js +548 -0
- package/dist/webgpu_util-DhSeP4b6.js +80 -0
- package/dist/{zeros-YJDE7oRb.js → zeros-DnPT2nD4.js} +10 -10
- package/package.json +2 -1
- package/dist/gpgpu_math-CNslybmD.js +0 -3115
- package/dist/norm-CzltS9Fz.js +0 -86
|
@@ -1,32 +1,35 @@
|
|
|
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 { m as Su } from "./max-
|
|
16
|
-
import { r as Ru } from "./reciprocal-
|
|
17
|
-
import { s as Xs } from "./split-
|
|
18
|
-
import { s as Tu } from "./softmax-
|
|
19
|
-
import { s as Du } from "./stack-
|
|
20
|
-
import { s as Eu } from "./sum-
|
|
21
|
-
import { a as j, u as ue, c as ut, i as dt,
|
|
22
|
-
import { m as xt,
|
|
23
|
-
import { g as ye, a as $e, b as Re, c as Ee, e as Oe, h as Fs } from "./axis_util-
|
|
24
|
-
import { s as
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import { M as
|
|
29
|
-
import {
|
|
1
|
+
import { B as oe, C as se, E as le, cl as ps, cm as hs, co as en, cp as fs, cq as ms, cs as gs, I as xs, cr as Cs, ct as bs, bp as To, l as Y, dd as tn, cz as sn, n as Do, z as nn, br as Eo, cD as Is, cE as ys, cF as $s, aq as Nc, cI as on, y as vc, a as an, k as Ne, dl as ks, cL as rn, cM as ws, X as It, bw as Fo, cQ as Ns, dg as cn, dj as ln, b as Po, bA as Oo, ds as un, cS as vs, dv as dn, dw as pn, al as xe, dx as S, aT as Sc, o as Rc, T as Ao, dy as Tc, cT as Dc, x as Ec, q as Fc, aU as Pc, c as Oc, ac as L, d2 as _o, d3 as Lo, e as Me, aO as Vt, d7 as Vo, aM as Wo, d4 as Ac, aL as Wt, aj as Ke, d8 as Mo, as as hn, an as _c, j as z, bg as Ge, ap as Lc, at as fn, au as mn, K as Vc, a2 as Wc, J as Bo, a1 as ne, cd as Go, cn as zo, bE as Uo, p as me, a7 as st, bF as Ho, bG as Xo, bH as Ko, ab as ct, bI as qo, cu as jo, cv as Yo, bL as Qo, bK as Zo, aP as Jo, dc as ea, bM as gn, cx as ta, aY as sa, Q as na, bN as oa, by as Te, c9 as aa, bO as ra, bP as ia, cy as ca, bQ as la, a8 as xn, bR as Cn, b6 as ua, bS as da, u as nt, H 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, cA as Kn, dz as mt, dA as Ca, cB as qn, df as Bc, Y as Gc, aR as ba, cC as Ia, bW as In, aV as ya, az as $a, ao as yt, d9 as ka, da as wa, b7 as Na, ca as va, di as Sa, a4 as Ra, G as Ta, dk as Da, bX as yn, b0 as $n, bZ as kn, cH as Ea, U as zc, b_ as Fa, b$ as Pa, cJ as Oa, cK as Aa, dm as _a, c0 as La, aS as Va, bh as Wa, S as Ma, ad as Ba, b9 as Ga, bb as za, ba as Ua, c1 as Ha, cU as Xa, c2 as Ka, P as qa, a5 as ja, c3 as Ya, cN as wn, dB as Qa, dC as Za, dD as Ja, R as er, V as Nn, bc as tr, cO as sr, bd as nr, cP as or, c5 as ar, b8 as rr, b3 as vn, a3 as ir, dn as cr, aQ as lr, c6 as Sn, a9 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, L as gr, cR as xr, av as En, dt as Cr, dG as br, dH as Ir, bJ as Fn, du as yr, N as $r, be as kr, ax 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, W as Zc, bn as Jc, bv as el, b2 as tl, bj as sl, bk as nl, aI as Rr, bq as ol, ae as al, ak as rl, bs as il, dh as cl, aW as ll, aX as ul, aZ as dl, a_ as pl, af as hl, bt as fl, b1 as ml, bC as gl, a$ as xl, ay as Tr, bx as Cl, ar as bl, bz as Il, bB as yl } from "./index-UdZhlibC.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-DbSpgl4o.js";
|
|
3
|
+
import { r as re } from "./reshape-BR0eoLYN.js";
|
|
4
|
+
import { b as jl } from "./broadcast_to-Ba9h_8DO.js";
|
|
5
|
+
import { c as os } from "./concat-CbXTetof.js";
|
|
6
|
+
import { c as Yl, s as Ql } from "./sin-CiBxrDqX.js";
|
|
7
|
+
import { w as Lr, o as Vr, n as ss, a as zs, r as Us, p as Wr, f as Zl, g as Jl, d as eu, b as tu, e as su, k as nu, m as ou, q as au, v as ru, x as iu, s as cu, c as lu, t as uu, u as du } from "./ops-aRTXR2Sr.js";
|
|
8
|
+
import { m as Tt } from "./mat_mul-dwmZz69e.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-Ce6pu9IM.js";
|
|
10
|
+
import { e as $u, l as ku, a as wu } from "./log_sum_exp-BnmCkHWl.js";
|
|
11
|
+
import { f as Nu } from "./dropout-DPfPgWWe.js";
|
|
12
|
+
import { g as vu } from "./gather-Bbh8DHhM.js";
|
|
13
|
+
import { c as Hs, z as Hr } from "./zeros-DnPT2nD4.js";
|
|
14
|
+
import { s as as } from "./slice-BHbDHObE.js";
|
|
15
|
+
import { m as Su } from "./max-ByjEGoFx.js";
|
|
16
|
+
import { r as Ru } from "./reciprocal-CGB48wZB.js";
|
|
17
|
+
import { s as Xs } from "./split-CRU0PjVV.js";
|
|
18
|
+
import { s as Tu } from "./softmax-JMEIUo2J.js";
|
|
19
|
+
import { s as Du } from "./stack-ikk2Y8_P.js";
|
|
20
|
+
import { s as Eu } from "./sum-NLYbiDag.js";
|
|
21
|
+
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-Czipaeb6.js";
|
|
22
|
+
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-C9Ut8n0Q.js";
|
|
23
|
+
import { g as ye, a as $e, b as Re, c as Ee, e as Oe, h as Fs } from "./axis_util-5DTW2tFV.js";
|
|
24
|
+
import { s as zd } from "./index-C4L8Cm77.js";
|
|
25
|
+
import { n as mi, b as gi, a as xi } from "./non_max_suppression_impl-CsEgBuMA.js";
|
|
26
|
+
import { c as wt } from "./scatter_nd_util-OjyAxku2.js";
|
|
27
|
+
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-DffelNS-.js";
|
|
28
|
+
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-DS5waSIY.js";
|
|
29
|
+
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-CXDy3EN7.js";
|
|
30
|
+
import { R as hh, r as H, a as fh } from "./Reshape-CEsEp0AI.js";
|
|
31
|
+
import { M as Ri } from "./mulmat_packed_gpu-IGPBp6h9.js";
|
|
32
|
+
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-CVYNbZxu.js";
|
|
30
33
|
/**
|
|
31
34
|
* @license
|
|
32
35
|
* Copyright 2018 Google LLC. All Rights Reserved.
|
|
@@ -345,7 +348,7 @@ const Hh = /* @__PURE__ */ oe({ dot_: Uh });
|
|
|
345
348
|
* =============================================================================
|
|
346
349
|
*/
|
|
347
350
|
function Xh(o, t = null, e = !1) {
|
|
348
|
-
return
|
|
351
|
+
return Vr(o, "euclidean", t, e);
|
|
349
352
|
}
|
|
350
353
|
const Kh = /* @__PURE__ */ oe({ euclideanNorm_: Xh });
|
|
351
354
|
/**
|
|
@@ -476,7 +479,7 @@ const nf = /* @__PURE__ */ oe({ localResponseNormalization_: sf });
|
|
|
476
479
|
*/
|
|
477
480
|
function of(o) {
|
|
478
481
|
const t = se(o, "x", "logSigmoid");
|
|
479
|
-
return vc((n) => ({ value: ss(Er(ss(n))), gradFunc: (r) => an(r,
|
|
482
|
+
return vc((n) => ({ value: ss(Er(ss(n))), gradFunc: (r) => an(r, Mr(ss(n))) }))(t);
|
|
480
483
|
}
|
|
481
484
|
const af = /* @__PURE__ */ oe({ logSigmoid_: of });
|
|
482
485
|
/**
|
|
@@ -722,7 +725,7 @@ function wf(o) {
|
|
|
722
725
|
const s = re(o, [e, t]);
|
|
723
726
|
n = qs(s);
|
|
724
727
|
} else {
|
|
725
|
-
const s = [e, 2 * (t - 1)], a = re(Us(o), [e, t]), r = re(
|
|
728
|
+
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
729
|
n = qs(p);
|
|
727
730
|
}
|
|
728
731
|
if (n = Us(n), o.rank === 3 && o.shape[0] !== 0) {
|
|
@@ -758,10 +761,10 @@ function vf(o, t) {
|
|
|
758
761
|
m[o.shape.length - 1] = t, s = as(o, f, m), e = t;
|
|
759
762
|
} else if (t != null && t > e) {
|
|
760
763
|
const f = o.shape.map((m) => m);
|
|
761
|
-
f[o.shape.length - 1] = t - e, s = os([o,
|
|
764
|
+
f[o.shape.length - 1] = t - e, s = os([o, Hr(f)], o.shape.length - 1), e = t;
|
|
762
765
|
} else
|
|
763
766
|
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 =
|
|
767
|
+
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
768
|
return h[s.shape.length - 1] = c, re(Hs(p[0], d[0]), h);
|
|
766
769
|
}
|
|
767
770
|
const Sf = /* @__PURE__ */ oe({ rfft_: vf });
|
|
@@ -1698,7 +1701,7 @@ S().prototype.dot = function(o) {
|
|
|
1698
1701
|
* =============================================================================
|
|
1699
1702
|
*/
|
|
1700
1703
|
S().prototype.elu = function() {
|
|
1701
|
-
return this.throwIfDisposed(),
|
|
1704
|
+
return this.throwIfDisposed(), pu(this);
|
|
1702
1705
|
};
|
|
1703
1706
|
/**
|
|
1704
1707
|
* @license
|
|
@@ -2059,7 +2062,7 @@ S().prototype.isNaN = function() {
|
|
|
2059
2062
|
* =============================================================================
|
|
2060
2063
|
*/
|
|
2061
2064
|
S().prototype.leakyRelu = function(o) {
|
|
2062
|
-
return this.throwIfDisposed(),
|
|
2065
|
+
return this.throwIfDisposed(), hu(this, o);
|
|
2063
2066
|
};
|
|
2064
2067
|
/**
|
|
2065
2068
|
* @license
|
|
@@ -2385,7 +2388,7 @@ S().prototype.mean = function(o, t) {
|
|
|
2385
2388
|
* =============================================================================
|
|
2386
2389
|
*/
|
|
2387
2390
|
S().prototype.min = function(o, t) {
|
|
2388
|
-
return this.throwIfDisposed(),
|
|
2391
|
+
return this.throwIfDisposed(), nu(this, o, t);
|
|
2389
2392
|
};
|
|
2390
2393
|
/**
|
|
2391
2394
|
* @license
|
|
@@ -2404,7 +2407,7 @@ S().prototype.min = function(o, t) {
|
|
|
2404
2407
|
* =============================================================================
|
|
2405
2408
|
*/
|
|
2406
2409
|
S().prototype.minimum = function(o) {
|
|
2407
|
-
return this.throwIfDisposed(),
|
|
2410
|
+
return this.throwIfDisposed(), ou(this, o);
|
|
2408
2411
|
};
|
|
2409
2412
|
/**
|
|
2410
2413
|
* @license
|
|
@@ -2499,7 +2502,7 @@ S().prototype.neg = function() {
|
|
|
2499
2502
|
* =============================================================================
|
|
2500
2503
|
*/
|
|
2501
2504
|
S().prototype.norm = function(o, t, e) {
|
|
2502
|
-
return this.throwIfDisposed(),
|
|
2505
|
+
return this.throwIfDisposed(), Vr(this, o, t, e);
|
|
2503
2506
|
};
|
|
2504
2507
|
/**
|
|
2505
2508
|
* @license
|
|
@@ -2616,7 +2619,7 @@ S().prototype.pow = function(o) {
|
|
|
2616
2619
|
* =============================================================================
|
|
2617
2620
|
*/
|
|
2618
2621
|
S().prototype.prelu = function(o) {
|
|
2619
|
-
return this.throwIfDisposed(),
|
|
2622
|
+
return this.throwIfDisposed(), fu(this, o);
|
|
2620
2623
|
};
|
|
2621
2624
|
/**
|
|
2622
2625
|
* @license
|
|
@@ -2673,7 +2676,7 @@ S().prototype.reciprocal = function() {
|
|
|
2673
2676
|
* =============================================================================
|
|
2674
2677
|
*/
|
|
2675
2678
|
S().prototype.relu = function() {
|
|
2676
|
-
return this.throwIfDisposed(),
|
|
2679
|
+
return this.throwIfDisposed(), mu(this);
|
|
2677
2680
|
};
|
|
2678
2681
|
/**
|
|
2679
2682
|
* @license
|
|
@@ -2692,7 +2695,7 @@ S().prototype.relu = function() {
|
|
|
2692
2695
|
* =============================================================================
|
|
2693
2696
|
*/
|
|
2694
2697
|
S().prototype.relu6 = function() {
|
|
2695
|
-
return this.throwIfDisposed(),
|
|
2698
|
+
return this.throwIfDisposed(), gu(this);
|
|
2696
2699
|
};
|
|
2697
2700
|
/**
|
|
2698
2701
|
* @license
|
|
@@ -2749,7 +2752,7 @@ S().prototype.reshape = function(o) {
|
|
|
2749
2752
|
* =============================================================================
|
|
2750
2753
|
*/
|
|
2751
2754
|
S().prototype.resizeBilinear = function(o, t, e) {
|
|
2752
|
-
return this.throwIfDisposed(),
|
|
2755
|
+
return this.throwIfDisposed(), au(this, o, t, e);
|
|
2753
2756
|
};
|
|
2754
2757
|
/**
|
|
2755
2758
|
* @license
|
|
@@ -2768,7 +2771,7 @@ S().prototype.resizeBilinear = function(o, t, e) {
|
|
|
2768
2771
|
* =============================================================================
|
|
2769
2772
|
*/
|
|
2770
2773
|
S().prototype.resizeNearestNeighbor = function(o, t, e) {
|
|
2771
|
-
return this.throwIfDisposed(),
|
|
2774
|
+
return this.throwIfDisposed(), ru(this, o, t, e);
|
|
2772
2775
|
};
|
|
2773
2776
|
/**
|
|
2774
2777
|
* @license
|
|
@@ -2825,7 +2828,7 @@ S().prototype.rfft = function() {
|
|
|
2825
2828
|
* =============================================================================
|
|
2826
2829
|
*/
|
|
2827
2830
|
S().prototype.round = function() {
|
|
2828
|
-
return this.throwIfDisposed(),
|
|
2831
|
+
return this.throwIfDisposed(), iu(this);
|
|
2829
2832
|
};
|
|
2830
2833
|
/**
|
|
2831
2834
|
* @license
|
|
@@ -2901,7 +2904,7 @@ S().prototype.separableConv2d = function(o, t, e, n, s, a) {
|
|
|
2901
2904
|
* =============================================================================
|
|
2902
2905
|
*/
|
|
2903
2906
|
S().prototype.sigmoid = function() {
|
|
2904
|
-
return this.throwIfDisposed(),
|
|
2907
|
+
return this.throwIfDisposed(), Mr(this);
|
|
2905
2908
|
};
|
|
2906
2909
|
/**
|
|
2907
2910
|
* @license
|
|
@@ -3129,7 +3132,7 @@ S().prototype.squaredDifference = function(o) {
|
|
|
3129
3132
|
* =============================================================================
|
|
3130
3133
|
*/
|
|
3131
3134
|
S().prototype.squeeze = function(o) {
|
|
3132
|
-
return this.throwIfDisposed(),
|
|
3135
|
+
return this.throwIfDisposed(), cu(this, o);
|
|
3133
3136
|
};
|
|
3134
3137
|
/**
|
|
3135
3138
|
* @license
|
|
@@ -3169,7 +3172,7 @@ S().prototype.stack = function(o, t) {
|
|
|
3169
3172
|
* =============================================================================
|
|
3170
3173
|
*/
|
|
3171
3174
|
S().prototype.step = function(o) {
|
|
3172
|
-
return this.throwIfDisposed(),
|
|
3175
|
+
return this.throwIfDisposed(), xu(this, o);
|
|
3173
3176
|
};
|
|
3174
3177
|
/**
|
|
3175
3178
|
* @license
|
|
@@ -3283,7 +3286,7 @@ S().prototype.tanh = function() {
|
|
|
3283
3286
|
* =============================================================================
|
|
3284
3287
|
*/
|
|
3285
3288
|
S().prototype.tile = function(o) {
|
|
3286
|
-
return this.throwIfDisposed(),
|
|
3289
|
+
return this.throwIfDisposed(), lu(this, o);
|
|
3287
3290
|
};
|
|
3288
3291
|
/**
|
|
3289
3292
|
* @license
|
|
@@ -3378,7 +3381,7 @@ S().prototype.topk = function(o, t) {
|
|
|
3378
3381
|
* =============================================================================
|
|
3379
3382
|
*/
|
|
3380
3383
|
S().prototype.transpose = function(o) {
|
|
3381
|
-
return this.throwIfDisposed(),
|
|
3384
|
+
return this.throwIfDisposed(), uu(this, o);
|
|
3382
3385
|
};
|
|
3383
3386
|
/**
|
|
3384
3387
|
* @license
|
|
@@ -3435,7 +3438,7 @@ S().prototype.unsortedSegmentSum = function(o, t) {
|
|
|
3435
3438
|
* =============================================================================
|
|
3436
3439
|
*/
|
|
3437
3440
|
S().prototype.unstack = function(o) {
|
|
3438
|
-
return this.throwIfDisposed(),
|
|
3441
|
+
return this.throwIfDisposed(), du(this, o);
|
|
3439
3442
|
};
|
|
3440
3443
|
/**
|
|
3441
3444
|
* @license
|
|
@@ -4677,7 +4680,7 @@ const Em = {
|
|
|
4677
4680
|
function Fm(o) {
|
|
4678
4681
|
const { inputs: t, backend: e, attrs: n } = o, { x: s } = t, { blockShape: a, crops: r } = n;
|
|
4679
4682
|
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 =
|
|
4683
|
+
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
4684
|
inputs: { x: m },
|
|
4682
4685
|
backend: e,
|
|
4683
4686
|
attrs: { begin: p, size: d }
|
|
@@ -4706,7 +4709,7 @@ const Pm = {
|
|
|
4706
4709
|
* =============================================================================
|
|
4707
4710
|
*/
|
|
4708
4711
|
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 =
|
|
4712
|
+
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
4713
|
return e.makeTensorInfo([r], a.dtype, l);
|
|
4711
4714
|
}
|
|
4712
4715
|
const Am = {
|
|
@@ -4834,7 +4837,7 @@ const Gm = {
|
|
|
4834
4837
|
*/
|
|
4835
4838
|
function bt(o) {
|
|
4836
4839
|
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
|
-
|
|
4840
|
+
Qr(r, a);
|
|
4838
4841
|
let i = je(t.map((m) => m.shape), a);
|
|
4839
4842
|
if (z(i) === 0)
|
|
4840
4843
|
return e.makeTensorInfo(i, t[0].dtype, []);
|
|
@@ -5427,7 +5430,7 @@ const ug = {
|
|
|
5427
5430
|
function dg(o) {
|
|
5428
5431
|
const { inputs: t, backend: e, attrs: n } = o, { x: s, weights: a } = t, { size: r, binaryOutput: i } = n;
|
|
5429
5432
|
if (s.shape.length === 1) {
|
|
5430
|
-
const c = e.data.get(s.dataId).values, l = e.data.get(a.dataId).values, u =
|
|
5433
|
+
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
5434
|
return e.makeTensorInfo([r], a.dtype, u);
|
|
5432
5435
|
} else if (s.shape.length === 2) {
|
|
5433
5436
|
const c = e.bufferSync(s), l = e.bufferSync(a), u = Ou(c, l, r, i);
|
|
@@ -5937,16 +5940,16 @@ const Sg = {
|
|
|
5937
5940
|
* =============================================================================
|
|
5938
5941
|
*/
|
|
5939
5942
|
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 } =
|
|
5943
|
+
const { inputs: t, backend: e, attrs: n } = o, { equation: s } = n, a = t, { allDims: r, summedDims: i, idDims: c } = Zr(s, a.length);
|
|
5944
|
+
Jr(r.length, c, a);
|
|
5945
|
+
const { path: l, steps: u } = ei(i, c), p = u.length;
|
|
5943
5946
|
let d = null, h = r.length;
|
|
5944
5947
|
const f = [];
|
|
5945
5948
|
for (let m = 0; m < p; ++m) {
|
|
5946
5949
|
for (const x of u[m]) {
|
|
5947
|
-
const { permutationIndices: g, expandDims: C } =
|
|
5950
|
+
const { permutationIndices: g, expandDims: C } = ti(h, c[x]);
|
|
5948
5951
|
let I;
|
|
5949
|
-
|
|
5952
|
+
si(g) ? I = a[x] : (I = Pe({ inputs: { x: a[x] }, backend: e, attrs: { perm: g } }), f.push(I));
|
|
5950
5953
|
const b = I.shape.slice();
|
|
5951
5954
|
for (let y = 0; y < C.length; ++y)
|
|
5952
5955
|
b.splice(C[y], 0, 1);
|
|
@@ -6017,7 +6020,7 @@ const Eg = {
|
|
|
6017
6020
|
* limitations under the License.
|
|
6018
6021
|
* =============================================================================
|
|
6019
6022
|
*/
|
|
6020
|
-
const Fg =
|
|
6023
|
+
const Fg = ci, Pg = ii, Og = ri, Ag = ai, _g = oi, Lg = ni, Vg = ue(In, (o) => {
|
|
6021
6024
|
const t = Math.sign(o), e = Math.abs(o), n = 1 / (1 + Fg * e);
|
|
6022
6025
|
return t * (1 - ((((Lg * n + _g) * n + Ag) * n + Og) * n + Pg) * n * Math.exp(-e * e));
|
|
6023
6026
|
}), Wg = {
|
|
@@ -6101,7 +6104,7 @@ function zi(o, t, e) {
|
|
|
6101
6104
|
attrs: { begin: [x, 0], size: [1, a] }
|
|
6102
6105
|
}), I = Be({ inputs: { real: g, imag: C }, backend: e }), { real: b, imag: y } = Gg(I, t, e), $ = xt(b, y);
|
|
6103
6106
|
for (let k = 0; k < a; k++) {
|
|
6104
|
-
const w =
|
|
6107
|
+
const w = li($, k);
|
|
6105
6108
|
p[x * a + k] = w.real, d[x * a + k] = w.imag;
|
|
6106
6109
|
}
|
|
6107
6110
|
e.disposeIntermediateTensorInfo(g), e.disposeIntermediateTensorInfo(C), e.disposeIntermediateTensorInfo(I);
|
|
@@ -6120,7 +6123,7 @@ function Gg(o, t, e) {
|
|
|
6120
6123
|
return i;
|
|
6121
6124
|
} else {
|
|
6122
6125
|
const i = xt(a, r), c = Ug(i, n, t);
|
|
6123
|
-
return
|
|
6126
|
+
return Od(c);
|
|
6124
6127
|
}
|
|
6125
6128
|
}
|
|
6126
6129
|
function zg(o) {
|
|
@@ -6129,13 +6132,13 @@ function zg(o) {
|
|
|
6129
6132
|
function Ys(o, t, e, n, s) {
|
|
6130
6133
|
if (e === 1)
|
|
6131
6134
|
return { real: o, imag: t };
|
|
6132
|
-
const a = xt(o, t), r = e / 2, i =
|
|
6135
|
+
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
6136
|
inputs: { real: v, imag: N },
|
|
6134
6137
|
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 =
|
|
6138
|
+
}), 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
6139
|
inputs: { a: P, b: U },
|
|
6137
6140
|
backend: s
|
|
6138
|
-
}), X =
|
|
6141
|
+
}), X = Kr({
|
|
6139
6142
|
inputs: { a: P, b: U },
|
|
6140
6143
|
backend: s
|
|
6141
6144
|
}), 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 +6157,10 @@ function Ug(o, t, e) {
|
|
|
6154
6157
|
for (let s = 0; s < t; s++) {
|
|
6155
6158
|
let a = 0, r = 0;
|
|
6156
6159
|
for (let i = 0; i < t; i++) {
|
|
6157
|
-
const c =
|
|
6160
|
+
const c = Wd(s * i, t, e), l = li(o, i);
|
|
6158
6161
|
a += l.real * c.real - l.imag * c.imag, r += l.real * c.imag + l.imag * c.real;
|
|
6159
6162
|
}
|
|
6160
|
-
e && (a /= t, r /= t),
|
|
6163
|
+
e && (a /= t, r /= t), Vd(n, a, r, s);
|
|
6161
6164
|
}
|
|
6162
6165
|
return n;
|
|
6163
6166
|
}
|
|
@@ -6367,7 +6370,7 @@ const Jg = {
|
|
|
6367
6370
|
* =============================================================================
|
|
6368
6371
|
*/
|
|
6369
6372
|
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] =
|
|
6373
|
+
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
6374
|
if (l === 0)
|
|
6372
6375
|
return e.makeTensorInfo(c, n.dtype, []);
|
|
6373
6376
|
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 +6407,7 @@ function sx(o) {
|
|
|
6404
6407
|
}
|
|
6405
6408
|
let p = i;
|
|
6406
6409
|
i == null && (p = 0);
|
|
6407
|
-
const d = z(a.shape), h =
|
|
6410
|
+
const d = z(a.shape), h = di(s, a, c, p), f = he({
|
|
6408
6411
|
inputs: { x: s },
|
|
6409
6412
|
backend: e,
|
|
6410
6413
|
attrs: {
|
|
@@ -7132,7 +7135,7 @@ function Hi(o) {
|
|
|
7132
7135
|
inputs: { x: s },
|
|
7133
7136
|
backend: e,
|
|
7134
7137
|
attrs: { reductionIndices: c, keepDims: !1 }
|
|
7135
|
-
}), u = Oe(l.shape, c), p = he({ inputs: { x: l }, backend: e, attrs: { shape: u } }), d =
|
|
7138
|
+
}), 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
7139
|
return e.disposeIntermediateTensorInfo(l), e.disposeIntermediateTensorInfo(p), e.disposeIntermediateTensorInfo(d), e.disposeIntermediateTensorInfo(h), e.disposeIntermediateTensorInfo(f), e.disposeIntermediateTensorInfo(m), x;
|
|
7137
7140
|
}
|
|
7138
7141
|
const qx = {
|
|
@@ -7165,7 +7168,7 @@ function jx(o) {
|
|
|
7165
7168
|
x[0] = p[m];
|
|
7166
7169
|
for (let I = 1; I < x.length; ++I)
|
|
7167
7170
|
x[I] = x[I - 1] + p[m + I];
|
|
7168
|
-
const g =
|
|
7171
|
+
const g = zd.alea(r.toString()), C = f * a;
|
|
7169
7172
|
for (let I = 0; I < a; ++I) {
|
|
7170
7173
|
const b = g();
|
|
7171
7174
|
h[C + I] = x.length;
|
|
@@ -7199,7 +7202,7 @@ const Yx = {
|
|
|
7199
7202
|
* limitations under the License.
|
|
7200
7203
|
* =============================================================================
|
|
7201
7204
|
*/
|
|
7202
|
-
const Qx =
|
|
7205
|
+
const Qx = mi;
|
|
7203
7206
|
function Zx(o) {
|
|
7204
7207
|
const { inputs: t, backend: e, attrs: n } = o, { boxes: s, scores: a } = t, { maxOutputSize: r, iouThreshold: i, scoreThreshold: c } = n;
|
|
7205
7208
|
j(s, "NonMaxSuppression");
|
|
@@ -7227,7 +7230,7 @@ const Jx = {
|
|
|
7227
7230
|
* limitations under the License.
|
|
7228
7231
|
* =============================================================================
|
|
7229
7232
|
*/
|
|
7230
|
-
const eC =
|
|
7233
|
+
const eC = gi;
|
|
7231
7234
|
function tC(o) {
|
|
7232
7235
|
const { inputs: t, backend: e, attrs: n } = o, { boxes: s, scores: a } = t, { maxOutputSize: r, iouThreshold: i, scoreThreshold: c, padToMaxOutputSize: l } = n;
|
|
7233
7236
|
j(s, "NonMaxSuppressionPadded");
|
|
@@ -7258,7 +7261,7 @@ const sC = {
|
|
|
7258
7261
|
* limitations under the License.
|
|
7259
7262
|
* =============================================================================
|
|
7260
7263
|
*/
|
|
7261
|
-
const nC =
|
|
7264
|
+
const nC = xi;
|
|
7262
7265
|
function oC(o) {
|
|
7263
7266
|
const { inputs: t, backend: e, attrs: n } = o, { boxes: s, scores: a } = t, { maxOutputSize: r, iouThreshold: i, scoreThreshold: c, softNmsSigma: l } = n;
|
|
7264
7267
|
j(s, "NonMaxSuppressionWithScore");
|
|
@@ -7842,7 +7845,7 @@ const AC = {
|
|
|
7842
7845
|
kernelName: rr,
|
|
7843
7846
|
backendName: "cpu",
|
|
7844
7847
|
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] =
|
|
7848
|
+
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
7849
|
for (let b = 0; b < l; b++) {
|
|
7847
7850
|
const y = b * p * u * d;
|
|
7848
7851
|
for (let $ = 0; $ < u; $++) {
|
|
@@ -8026,7 +8029,7 @@ const XC = {
|
|
|
8026
8029
|
* limitations under the License.
|
|
8027
8030
|
* =============================================================================
|
|
8028
8031
|
*/
|
|
8029
|
-
const KC =
|
|
8032
|
+
const KC = Gr, qC = Br, jC = ue(Sn, (o) => o >= 0 ? qC * o : KC * (Math.exp(o) - 1)), YC = {
|
|
8030
8033
|
kernelName: Sn,
|
|
8031
8034
|
backendName: "cpu",
|
|
8032
8035
|
kernelFunc: jC
|
|
@@ -8262,7 +8265,7 @@ function pb(o) {
|
|
|
8262
8265
|
${a.shape}`);
|
|
8263
8266
|
if (s.shape[0] !== a.shape[0])
|
|
8264
8267
|
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] =
|
|
8268
|
+
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
8269
|
return e.makeTensorInfo(u, n.dtype, l);
|
|
8267
8270
|
}
|
|
8268
8271
|
const hb = {
|
|
@@ -8298,7 +8301,7 @@ function fb(o) {
|
|
|
8298
8301
|
${a.shape}`);
|
|
8299
8302
|
if (s.shape[0] !== a.shape[0])
|
|
8300
8303
|
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] =
|
|
8304
|
+
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
8305
|
return e.makeTensorInfo(u, n.dtype, l);
|
|
8303
8306
|
}
|
|
8304
8307
|
const mb = {
|
|
@@ -8373,7 +8376,7 @@ const xb = {
|
|
|
8373
8376
|
* =============================================================================
|
|
8374
8377
|
*/
|
|
8375
8378
|
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 =
|
|
8379
|
+
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
8380
|
return c.map((p) => {
|
|
8378
8381
|
const d = [...u];
|
|
8379
8382
|
d[i] = p;
|
|
@@ -8459,13 +8462,13 @@ const yb = ue(En, (o, t) => {
|
|
|
8459
8462
|
function kb(o) {
|
|
8460
8463
|
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
8464
|
j(s, "stridedSlice");
|
|
8462
|
-
const { finalShapeSparse: h, finalShape: f, isIdentity: m, sliceDim0: x, isSimpleSlice: g, begin: C, end: I, strides: b } =
|
|
8465
|
+
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
8466
|
let y;
|
|
8464
8467
|
if (m)
|
|
8465
8468
|
y = he({ inputs: { x: s }, backend: e, attrs: { shape: f } });
|
|
8466
8469
|
else if (x || g) {
|
|
8467
8470
|
Y(s.shape.length >= 1, () => `Input must have rank at least 1, got: ${s.shape.length}`);
|
|
8468
|
-
const $ =
|
|
8471
|
+
const $ = Ur(C, I, b), k = gt({ inputs: { x: s }, backend: e, attrs: { begin: C, size: $ } });
|
|
8469
8472
|
y = he({ inputs: { x: k }, backend: e, attrs: { shape: f } }), e.disposeIntermediateTensorInfo(k);
|
|
8470
8473
|
} else {
|
|
8471
8474
|
const $ = e.bufferSync(s), k = qu(h, $, b, C);
|
|
@@ -9148,17 +9151,17 @@ K.registerFlag("WEBGL_PACK_REDUCE", () => K.getBool("WEBGL_PACK"));
|
|
|
9148
9151
|
K.registerFlag("WEBGL_LAZILY_UNPACK", () => K.getBool("WEBGL_PACK"));
|
|
9149
9152
|
K.registerFlag("WEBGL_CONV_IM2COL", () => K.getBool("WEBGL_PACK"));
|
|
9150
9153
|
K.registerFlag("WEBGL_PACK_CONV2DTRANSPOSE", () => K.getBool("WEBGL_PACK"));
|
|
9151
|
-
K.registerFlag("WEBGL_MAX_TEXTURE_SIZE", () =>
|
|
9152
|
-
K.registerFlag("WEBGL_MAX_TEXTURES_IN_SHADER", () =>
|
|
9154
|
+
K.registerFlag("WEBGL_MAX_TEXTURE_SIZE", () => Ud(K.getNumber("WEBGL_VERSION")));
|
|
9155
|
+
K.registerFlag("WEBGL_MAX_TEXTURES_IN_SHADER", () => Hd(K.getNumber("WEBGL_VERSION")));
|
|
9153
9156
|
K.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION", () => {
|
|
9154
9157
|
const o = K.getNumber("WEBGL_VERSION");
|
|
9155
|
-
return o === 0 ? 0 :
|
|
9158
|
+
return o === 0 ? 0 : Xd(o);
|
|
9156
9159
|
});
|
|
9157
9160
|
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", () =>
|
|
9161
|
+
K.registerFlag("WEBGL_RENDER_FLOAT32_CAPABLE", () => Kd(K.getNumber("WEBGL_VERSION")));
|
|
9159
9162
|
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", () =>
|
|
9163
|
+
K.registerFlag("WEBGL_DOWNLOAD_FLOAT_ENABLED", () => qd(K.getNumber("WEBGL_VERSION")));
|
|
9164
|
+
K.registerFlag("WEBGL_FENCE_API_ENABLED", () => jd(K.getNumber("WEBGL_VERSION")));
|
|
9162
9165
|
K.registerFlag("WEBGL_SIZE_UPLOAD_UNIFORM", () => K.getBool("WEBGL_RENDER_FLOAT32_ENABLED") ? 4 : 0);
|
|
9163
9166
|
K.registerFlag("WEBGL_DELETE_TEXTURE_THRESHOLD", () => -1, (o) => {
|
|
9164
9167
|
if (typeof o != "number")
|
|
@@ -9204,7 +9207,7 @@ class s1 {
|
|
|
9204
9207
|
const e = ze();
|
|
9205
9208
|
this.outputShape = t, this.enableShapeUniforms = We(this.outputShape.length), this.userCode = `
|
|
9206
9209
|
ivec3 outCoordsFromFlatIndex(int index) {
|
|
9207
|
-
${this.enableShapeUniforms ?
|
|
9210
|
+
${this.enableShapeUniforms ? Ci(["r", "c", "d"], t) : bi(["r", "c", "d"], t)}
|
|
9208
9211
|
return ivec3(r, c, d);
|
|
9209
9212
|
}
|
|
9210
9213
|
|
|
@@ -9247,7 +9250,7 @@ class n1 {
|
|
|
9247
9250
|
const e = ze();
|
|
9248
9251
|
this.outputShape = t, this.enableShapeUniforms = We(this.outputShape.length), this.userCode = `
|
|
9249
9252
|
ivec3 outCoordsFromFlatIndex(int index) {
|
|
9250
|
-
${this.enableShapeUniforms ?
|
|
9253
|
+
${this.enableShapeUniforms ? Ci(["r", "c", "d"], t) : bi(["r", "c", "d"], t)}
|
|
9251
9254
|
return ivec3(r, c, d);
|
|
9252
9255
|
}
|
|
9253
9256
|
|
|
@@ -9289,7 +9292,7 @@ class o1 {
|
|
|
9289
9292
|
this.variableNames = ["A"], this.outTexUsage = _e.DOWNLOAD;
|
|
9290
9293
|
const e = ze();
|
|
9291
9294
|
this.outputShape = t, this.userCode = `
|
|
9292
|
-
${
|
|
9295
|
+
${Ii}
|
|
9293
9296
|
|
|
9294
9297
|
void main() {
|
|
9295
9298
|
float x = getAAtOutCoords();
|
|
@@ -9319,7 +9322,7 @@ class a1 {
|
|
|
9319
9322
|
this.variableNames = ["A"], this.packedInputs = !0, this.packedOutput = !1, this.outTexUsage = _e.DOWNLOAD;
|
|
9320
9323
|
const e = ze();
|
|
9321
9324
|
this.outputShape = t, this.userCode = `
|
|
9322
|
-
${
|
|
9325
|
+
${Ii}
|
|
9323
9326
|
|
|
9324
9327
|
void main() {
|
|
9325
9328
|
ivec3 coords = getOutputCoords();
|
|
@@ -9367,7 +9370,7 @@ class io {
|
|
|
9367
9370
|
}`;
|
|
9368
9371
|
}
|
|
9369
9372
|
this.userCode = `
|
|
9370
|
-
${this.enableShapeUniforms ?
|
|
9373
|
+
${this.enableShapeUniforms ? yi() : $i(t)}
|
|
9371
9374
|
|
|
9372
9375
|
void main() {
|
|
9373
9376
|
ivec3 coords = getOutputCoords();
|
|
@@ -9446,7 +9449,7 @@ class i1 {
|
|
|
9446
9449
|
`;
|
|
9447
9450
|
}
|
|
9448
9451
|
this.userCode = `
|
|
9449
|
-
${this.enableShapeUniforms ?
|
|
9452
|
+
${this.enableShapeUniforms ? yi() : $i(t)}
|
|
9450
9453
|
|
|
9451
9454
|
void main() {
|
|
9452
9455
|
ivec3 coords = getOutputCoords();
|
|
@@ -9491,19 +9494,19 @@ function c1(o) {
|
|
|
9491
9494
|
gl_Position = vec4(clipSpacePos, 1);
|
|
9492
9495
|
resultUV = uv;
|
|
9493
9496
|
}`;
|
|
9494
|
-
return
|
|
9497
|
+
return Zd(o, e);
|
|
9495
9498
|
}
|
|
9496
9499
|
function l1(o) {
|
|
9497
9500
|
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
|
|
9501
|
+
return Yd(o, t);
|
|
9499
9502
|
}
|
|
9500
9503
|
function u1(o) {
|
|
9501
9504
|
const t = new Uint16Array([0, 1, 2, 2, 1, 3]);
|
|
9502
|
-
return
|
|
9505
|
+
return Qd(o, t);
|
|
9503
9506
|
}
|
|
9504
9507
|
function Ht(o, t, e, n, s, a) {
|
|
9505
|
-
|
|
9506
|
-
const r =
|
|
9508
|
+
Jd(t, e);
|
|
9509
|
+
const r = ep(o), i = o.TEXTURE_2D;
|
|
9507
9510
|
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
9511
|
}
|
|
9509
9512
|
function ji(o) {
|
|
@@ -9563,11 +9566,11 @@ function I1(o, t, e) {
|
|
|
9563
9566
|
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
9567
|
}
|
|
9565
9568
|
function y1(o, t, e, n) {
|
|
9566
|
-
const [s, a] = Mt(t, e), r = 4, i = new Uint8Array(
|
|
9569
|
+
const [s, a] = Mt(t, e), r = 4, i = new Uint8Array(tp(t * e, r));
|
|
9567
9570
|
return Z(o, () => o.readPixels(0, 0, s, a, n.downloadTextureFormat, o.UNSIGNED_BYTE, i)), new Float32Array(i.buffer);
|
|
9568
9571
|
}
|
|
9569
9572
|
function $1(o, t, e, n, s, a, r, i) {
|
|
9570
|
-
const c = o, l = new Float32Array(
|
|
9573
|
+
const c = o, l = new Float32Array(sp(a, r));
|
|
9571
9574
|
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
9575
|
}
|
|
9573
9576
|
function k1(o, t, e) {
|
|
@@ -9594,7 +9597,7 @@ class Ms {
|
|
|
9594
9597
|
constructor(t) {
|
|
9595
9598
|
this.outputTexture = null, this.program = null, this.disposed = !1, this.itemsToPoll = [];
|
|
9596
9599
|
const e = L().getNumber("WEBGL_VERSION");
|
|
9597
|
-
if (t != null ? (this.gl = t,
|
|
9600
|
+
if (t != null ? (this.gl = t, up(e, t)) : this.gl = Ks(e), t = this.gl, L().getNumber("WEBGL_VERSION") === 2) {
|
|
9598
9601
|
const a = t;
|
|
9599
9602
|
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
9603
|
} else if (t != null) {
|
|
@@ -9621,7 +9624,7 @@ class Ms {
|
|
|
9621
9624
|
this.colorBufferHalfFloatExtension = this.gl.getExtension(s);
|
|
9622
9625
|
else
|
|
9623
9626
|
throw new Error("GL context does not support color renderable floats");
|
|
9624
|
-
this.vertexBuffer = l1(this.gl), this.indexBuffer = u1(this.gl), this.framebuffer =
|
|
9627
|
+
this.vertexBuffer = l1(this.gl), this.indexBuffer = u1(this.gl), this.framebuffer = np(this.gl), this.textureConfig = op(this.gl, this.textureHalfFloatExtension);
|
|
9625
9628
|
}
|
|
9626
9629
|
get debug() {
|
|
9627
9630
|
return L().getBool("DEBUG");
|
|
@@ -9693,8 +9696,8 @@ class Ms {
|
|
|
9693
9696
|
this.throwIfDisposed();
|
|
9694
9697
|
const e = this.gl;
|
|
9695
9698
|
this.vertexShader == null && (this.vertexShader = c1(e));
|
|
9696
|
-
const n =
|
|
9697
|
-
Z(e, () => e.attachShader(n, this.vertexShader)), Z(e, () => e.attachShader(n, t)),
|
|
9699
|
+
const n = ap(e);
|
|
9700
|
+
Z(e, () => e.attachShader(n, this.vertexShader)), Z(e, () => e.attachShader(n, t)), rp(e, n);
|
|
9698
9701
|
const s = Object.assign(n, { vao: this.createVertexArray() });
|
|
9699
9702
|
return this.debug && Vs(e, s), s;
|
|
9700
9703
|
}
|
|
@@ -9710,7 +9713,7 @@ class Ms {
|
|
|
9710
9713
|
this.throwIfDisposed(), this.program = t, this.program != null && this.debug && Vs(this.gl, this.program), Z(this.gl, () => this.gl.useProgram(t));
|
|
9711
9714
|
}
|
|
9712
9715
|
getUniformLocation(t, e, n = !0) {
|
|
9713
|
-
return this.throwIfDisposed(), n ?
|
|
9716
|
+
return this.throwIfDisposed(), n ? ip(this.gl, t, e) : cp(this.gl, t, e);
|
|
9714
9717
|
}
|
|
9715
9718
|
getAttributeLocation(t, e) {
|
|
9716
9719
|
return this.throwIfDisposed(), Z(this.gl, () => this.gl.getAttribLocation(t, e));
|
|
@@ -9719,7 +9722,7 @@ class Ms {
|
|
|
9719
9722
|
return this.throwIfDisposed(), this.gl.getUniformLocation(t, e);
|
|
9720
9723
|
}
|
|
9721
9724
|
setInputMatrixTexture(t, e, n) {
|
|
9722
|
-
this.throwIfDisposed(), this.throwIfNoProgram(),
|
|
9725
|
+
this.throwIfDisposed(), this.throwIfNoProgram(), lp(this.gl, t, e, n);
|
|
9723
9726
|
}
|
|
9724
9727
|
setOutputMatrixTexture(t, e, n) {
|
|
9725
9728
|
this.setOutputMatrixTextureDriver(t, n, e);
|
|
@@ -10297,7 +10300,7 @@ class Os extends _o {
|
|
|
10297
10300
|
if (t != null)
|
|
10298
10301
|
for (let e = 0; e < t.length; e++) {
|
|
10299
10302
|
const n = t[e];
|
|
10300
|
-
if (!
|
|
10303
|
+
if (!dp(n))
|
|
10301
10304
|
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
10305
|
}
|
|
10303
10306
|
}
|
|
@@ -10423,7 +10426,7 @@ class Os extends _o {
|
|
|
10423
10426
|
// Also remove the op from unary_op.
|
|
10424
10427
|
abs(t) {
|
|
10425
10428
|
if (this.shouldExecuteOnCPU([t]) && t.dtype !== "complex64") {
|
|
10426
|
-
const s =
|
|
10429
|
+
const s = wi(this.texData.get(t.dataId).values);
|
|
10427
10430
|
return this.makeOutput(t.shape, t.dtype, s);
|
|
10428
10431
|
}
|
|
10429
10432
|
if (L().getBool("WEBGL_PACK_UNARY_OPERATIONS"))
|
|
@@ -10501,16 +10504,16 @@ class Os extends _o {
|
|
|
10501
10504
|
}
|
|
10502
10505
|
if (this.uploadToGPU(g.dataId), !!C.isPacked != !!t.packedInputs)
|
|
10503
10506
|
g = C.isPacked ? this.unpackTensor(g) : this.packTensor(g), l.push(g), C = this.texData.get(g.dataId);
|
|
10504
|
-
else if (C.isPacked && !
|
|
10507
|
+
else if (C.isPacked && !ki(C.shape, g.shape)) {
|
|
10505
10508
|
const I = g, b = g.shape;
|
|
10506
10509
|
g.shape = C.shape, g = this.packedReshape(g, b), l.push(g), C = this.texData.get(g.dataId), I.shape = b;
|
|
10507
10510
|
}
|
|
10508
10511
|
return { shape: g.shape, texData: C, isUniform: !1 };
|
|
10509
10512
|
});
|
|
10510
10513
|
this.uploadToGPU(i.dataId);
|
|
10511
|
-
const p = { shape: i.shape, texData: c, isUniform: !1 }, d =
|
|
10514
|
+
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
10515
|
let m;
|
|
10513
|
-
f && (m = this.startTimer()), L().get("ENGINE_COMPILE_ONLY") ||
|
|
10516
|
+
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
10517
|
const x = L().getNumber("WEBGL_FLUSH_THRESHOLD");
|
|
10515
10518
|
if (x > 0) {
|
|
10516
10519
|
const g = Ke();
|
|
@@ -10560,7 +10563,7 @@ class Os extends _o {
|
|
|
10560
10563
|
let u;
|
|
10561
10564
|
l && (u = Ke());
|
|
10562
10565
|
let p = e.texShape;
|
|
10563
|
-
if (p == null && (p =
|
|
10566
|
+
if (p == null && (p = mp(n, c), e.texShape = p), a != null) {
|
|
10564
10567
|
const d = Zt(n);
|
|
10565
10568
|
let h, f = p[1], m = p[0];
|
|
10566
10569
|
const x = a instanceof Uint8Array || a instanceof Uint8ClampedArray;
|
|
@@ -10617,13 +10620,13 @@ class Os extends _o {
|
|
|
10617
10620
|
}
|
|
10618
10621
|
checkCompletion_(t) {
|
|
10619
10622
|
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 ? (
|
|
10623
|
+
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
10624
|
return !0;
|
|
10622
10625
|
}
|
|
10623
10626
|
getUniformLocations() {
|
|
10624
10627
|
for (const t of Object.values(this.binaryCache)) {
|
|
10625
10628
|
this.gpgpu.buildVao(t.webGLProgram);
|
|
10626
|
-
const { variablesLocations: e, customUniformLocations: n, infLoc: s, nanLoc: a, outShapeLocation: r, outShapeStridesLocation: i, outTexShapeLocation: c } =
|
|
10629
|
+
const { variablesLocations: e, customUniformLocations: n, infLoc: s, nanLoc: a, outShapeLocation: r, outShapeStridesLocation: i, outTexShapeLocation: c } = xp(this.gpgpu, t.program, t.webGLProgram);
|
|
10627
10630
|
t.variablesLocations = e, t.customUniformLocations = n, t.infLoc = s, t.nanLoc = a, t.outShapeLocation = r, t.outShapeStridesLocation = i, t.outTexShapeLocation = c;
|
|
10628
10631
|
}
|
|
10629
10632
|
}
|
|
@@ -10757,7 +10760,7 @@ function Un(o) {
|
|
|
10757
10760
|
return e.disposeIntermediateTensorInfo(d), e.disposeIntermediateTensorInfo(h), f;
|
|
10758
10761
|
}
|
|
10759
10762
|
if (e.shouldExecuteOnCPU([n, s])) {
|
|
10760
|
-
const i = e.texData.get(n.dataId), c = e.texData.get(s.dataId), [l, u] =
|
|
10763
|
+
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
10764
|
return d.values = l, p;
|
|
10762
10765
|
}
|
|
10763
10766
|
let r;
|
|
@@ -10790,7 +10793,7 @@ function ve(o) {
|
|
|
10790
10793
|
c[u] = s.shape[a[u]];
|
|
10791
10794
|
let l;
|
|
10792
10795
|
if (r.shouldExecuteOnCPU([s])) {
|
|
10793
|
-
const p = r.texData.get(s.dataId).values, d =
|
|
10796
|
+
const p = r.texData.get(s.dataId).values, d = Ni(p, s.shape, s.dtype, a, c);
|
|
10794
10797
|
l = r.makeTensorInfo(c, s.dtype);
|
|
10795
10798
|
const h = r.texData.get(l.dataId);
|
|
10796
10799
|
h.values = d;
|
|
@@ -10913,7 +10916,7 @@ const mo = "return abs(x);";
|
|
|
10913
10916
|
function z1(o) {
|
|
10914
10917
|
const { inputs: t, backend: e } = o, { x: n } = t;
|
|
10915
10918
|
if (e.shouldExecuteOnCPU([n]) && n.dtype !== "complex64") {
|
|
10916
|
-
const a = e.texData.get(n.dataId), r =
|
|
10919
|
+
const a = e.texData.get(n.dataId), r = wi(a.values);
|
|
10917
10920
|
return e.makeTensorInfo(n.shape, n.dtype, r);
|
|
10918
10921
|
}
|
|
10919
10922
|
let s;
|
|
@@ -10993,7 +10996,7 @@ const go = "return a + b;", Q1 = ke({
|
|
|
10993
10996
|
opSnippet: go,
|
|
10994
10997
|
packedOpSnippet: go,
|
|
10995
10998
|
supportsComplex: !0,
|
|
10996
|
-
cpuKernelImpl:
|
|
10999
|
+
cpuKernelImpl: bp
|
|
10997
11000
|
}), Z1 = {
|
|
10998
11001
|
kernelName: Qc,
|
|
10999
11002
|
backendName: "webgl",
|
|
@@ -11332,7 +11335,7 @@ class iI {
|
|
|
11332
11335
|
function tc(o, t, e, n = null) {
|
|
11333
11336
|
let s = t.shape[0], a = t.shape[1];
|
|
11334
11337
|
n != null && (s = n.shape[0], a = n.shape[1]);
|
|
11335
|
-
const r =
|
|
11338
|
+
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
11339
|
n != null && l.push(n);
|
|
11337
11340
|
const u = o.runWebGLProgram(c, l, "int32");
|
|
11338
11341
|
if (u.shape[1] === 1)
|
|
@@ -11341,7 +11344,7 @@ function tc(o, t, e, n = null) {
|
|
|
11341
11344
|
return o.disposeIntermediateTensorInfo(u), p;
|
|
11342
11345
|
}
|
|
11343
11346
|
function sc(o, t, e, n = null) {
|
|
11344
|
-
const s = n != null ? n.shape : t.shape, a = s[s.length - 1], r =
|
|
11347
|
+
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
11348
|
if (l.shape.length === t.shape.length) {
|
|
11346
11349
|
const u = sc(o, t, e, l);
|
|
11347
11350
|
return o.disposeIntermediateTensorInfo(l), u;
|
|
@@ -12390,7 +12393,7 @@ class XI {
|
|
|
12390
12393
|
function KI(o, t, e, n) {
|
|
12391
12394
|
const s = n.texData.get(o.dataId), a = n.makeTensorInfo(e, o.dtype), r = n.texData.get(a.dataId);
|
|
12392
12395
|
Object.assign(r, s), r.refCount = 1, r.shape = e, r.dtype = o.dtype;
|
|
12393
|
-
let i =
|
|
12396
|
+
let i = yu(t, ne(o.shape));
|
|
12394
12397
|
s.slice && (i += s.slice.flatOffset), r.slice = {
|
|
12395
12398
|
flatOffset: i,
|
|
12396
12399
|
// Point to the original dataId, which is used to do ref counting.
|
|
@@ -12400,14 +12403,14 @@ function KI(o, t, e, n) {
|
|
|
12400
12403
|
return n.dataRefCount.set(r.slice.origDataId, c + 1), a;
|
|
12401
12404
|
}
|
|
12402
12405
|
function St(o) {
|
|
12403
|
-
const { inputs: t, backend: e, attrs: n } = o, { x: s } = t, { begin: a, size: r } = n, [i, c] =
|
|
12404
|
-
if (
|
|
12406
|
+
const { inputs: t, backend: e, attrs: n } = o, { x: s } = t, { begin: a, size: r } = n, [i, c] = Cu(s, a, r);
|
|
12407
|
+
if (bu(s, i, c), z(c) === 0)
|
|
12405
12408
|
return e.makeTensorInfo(c, s.dtype, []);
|
|
12406
12409
|
if (e.shouldExecuteOnCPU([s]) || s.dtype === "string") {
|
|
12407
|
-
const p = e.texData.get(s.dataId), d =
|
|
12410
|
+
const p = e.texData.get(s.dataId), d = Ip(p.values, i, c, s.shape, s.dtype);
|
|
12408
12411
|
return e.makeTensorInfo(c, s.dtype, d);
|
|
12409
12412
|
}
|
|
12410
|
-
const { isPacked: l } = e.texData.get(s.dataId), u =
|
|
12413
|
+
const { isPacked: l } = e.texData.get(s.dataId), u = Iu(s.shape, i, c);
|
|
12411
12414
|
if (l || !u) {
|
|
12412
12415
|
const p = L().getBool("WEBGL_PACK_ARRAY_OPERATIONS") ? new XI(c) : new UI(c), d = [i];
|
|
12413
12416
|
return e.runWebGLProgram(p, [s], s.dtype, d);
|
|
@@ -12438,7 +12441,7 @@ const qI = {
|
|
|
12438
12441
|
const jI = (o) => {
|
|
12439
12442
|
const { inputs: t, backend: e, attrs: n } = o, { x: s } = t, { blockShape: a, crops: r } = n;
|
|
12440
12443
|
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 =
|
|
12444
|
+
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
12445
|
inputs: { x: m },
|
|
12443
12446
|
backend: e,
|
|
12444
12447
|
attrs: { shape: u }
|
|
@@ -12470,7 +12473,7 @@ const jI = (o) => {
|
|
|
12470
12473
|
* =============================================================================
|
|
12471
12474
|
*/
|
|
12472
12475
|
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 =
|
|
12476
|
+
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
12477
|
return e.makeTensorInfo([r], a.dtype, l);
|
|
12475
12478
|
}
|
|
12476
12479
|
const ZI = {
|
|
@@ -12506,7 +12509,7 @@ const JI = `
|
|
|
12506
12509
|
function ty(o) {
|
|
12507
12510
|
const { inputs: t, backend: e } = o, { a: n, b: s } = t, a = L().getBool("WEBGL_PACK_BINARY_OPERATIONS"), r = L().getNumber("WEBGL_VERSION");
|
|
12508
12511
|
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] =
|
|
12512
|
+
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
12513
|
return h.values = u, d;
|
|
12511
12514
|
}
|
|
12512
12515
|
let i;
|
|
@@ -12558,7 +12561,7 @@ const oy = {
|
|
|
12558
12561
|
* limitations under the License.
|
|
12559
12562
|
* =============================================================================
|
|
12560
12563
|
*/
|
|
12561
|
-
const ay = "return float(a != b);", oc = ke({ opSnippet: ay, cpuKernelImpl:
|
|
12564
|
+
const ay = "return float(a != b);", oc = ke({ opSnippet: ay, cpuKernelImpl: $p, dtype: "bool" }), ry = {
|
|
12562
12565
|
kernelName: el,
|
|
12563
12566
|
backendName: "webgl",
|
|
12564
12567
|
kernelFunc: oc
|
|
@@ -12630,7 +12633,7 @@ function Zs(o) {
|
|
|
12630
12633
|
if (a === "complex64") {
|
|
12631
12634
|
if (s.dtype === "complex64")
|
|
12632
12635
|
return Le({ inputs: { x: s }, backend: e });
|
|
12633
|
-
const r =
|
|
12636
|
+
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
12637
|
return r.dispose(), e.disposeIntermediateTensorInfo(i), c;
|
|
12635
12638
|
}
|
|
12636
12639
|
if (s.dtype === "complex64") {
|
|
@@ -12642,7 +12645,7 @@ function Zs(o) {
|
|
|
12642
12645
|
return { dataId: r.dataId, shape: r.shape, dtype: a };
|
|
12643
12646
|
}
|
|
12644
12647
|
if (e.shouldExecuteOnCPU([s])) {
|
|
12645
|
-
const r = e.texData.get(s.dataId).values, [i, c, l] =
|
|
12648
|
+
const r = e.texData.get(s.dataId).values, [i, c, l] = kp(r, s.shape, s.dtype, a);
|
|
12646
12649
|
return e.makeTensorInfo(i, c, l);
|
|
12647
12650
|
}
|
|
12648
12651
|
if (a === "int32")
|
|
@@ -12674,7 +12677,7 @@ const uy = {
|
|
|
12674
12677
|
* limitations under the License.
|
|
12675
12678
|
* =============================================================================
|
|
12676
12679
|
*/
|
|
12677
|
-
const xo = "return ceil(x);", dy = ae({ opSnippet: xo, packedOpSnippet: xo, cpuKernelImpl:
|
|
12680
|
+
const xo = "return ceil(x);", dy = ae({ opSnippet: xo, packedOpSnippet: xo, cpuKernelImpl: wp }), py = {
|
|
12678
12681
|
kernelName: To,
|
|
12679
12682
|
backendName: "webgl",
|
|
12680
12683
|
kernelFunc: dy
|
|
@@ -13024,7 +13027,7 @@ function Et(o, t, e) {
|
|
|
13024
13027
|
h.map((b) => b.shape),
|
|
13025
13028
|
1
|
|
13026
13029
|
/* axis */
|
|
13027
|
-
), x = h[0].shape[0] === 1, g =
|
|
13030
|
+
), 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
13031
|
return h.forEach((b) => e.disposeIntermediateTensorInfo(b)), I;
|
|
13029
13032
|
}
|
|
13030
13033
|
const a = o.filter((h) => z(h.shape) > 0), r = L().getBool("WEBGL_PACK_ARRAY_OPERATIONS") && a[0].shape.length > 1;
|
|
@@ -13079,7 +13082,7 @@ function ky(o, t, e) {
|
|
|
13079
13082
|
*/
|
|
13080
13083
|
function ac(o) {
|
|
13081
13084
|
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
|
-
|
|
13085
|
+
Qr(r, a);
|
|
13083
13086
|
const i = je(t.map((l) => l.shape), a);
|
|
13084
13087
|
if (z(i) === 0)
|
|
13085
13088
|
return e.makeTensorInfo(i, t[0].dtype, []);
|
|
@@ -13726,7 +13729,7 @@ function cc({ x: o, filter: t, convInfo: e, backend: n, bias: s = null, preluAct
|
|
|
13726
13729
|
shape: [1, b, e.inChannels],
|
|
13727
13730
|
dtype: o.dtype
|
|
13728
13731
|
}, $ = l.shape;
|
|
13729
|
-
l.shape = l.shape.slice(), l.shape[l.shape.length - 2]++, Y(
|
|
13732
|
+
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
13733
|
const k = H({
|
|
13731
13734
|
inputs: { x: t },
|
|
13732
13735
|
backend: n,
|
|
@@ -14655,10 +14658,10 @@ const n0 = {
|
|
|
14655
14658
|
function o0(o) {
|
|
14656
14659
|
const { inputs: t, backend: e, attrs: n } = o, { x: s, weights: a } = t, { size: r, binaryOutput: i } = n;
|
|
14657
14660
|
if (s.shape.length === 1) {
|
|
14658
|
-
const c = e.readSync(s.dataId), l = e.readSync(a.dataId), u =
|
|
14661
|
+
const c = e.readSync(s.dataId), l = e.readSync(a.dataId), u = vi(c, l, a.dtype, a.shape, r);
|
|
14659
14662
|
return e.makeTensorInfo([r], a.dtype, u);
|
|
14660
14663
|
} else if (s.shape.length === 2) {
|
|
14661
|
-
const c = e.bufferSync(s), l = e.bufferSync(a), u =
|
|
14664
|
+
const c = e.bufferSync(s), l = e.bufferSync(a), u = vp(c, l, r, i);
|
|
14662
14665
|
return e.makeTensorInfo(u.shape, a.dtype, u.values);
|
|
14663
14666
|
}
|
|
14664
14667
|
throw new Error(`Error in denseBincount: input must be at most rank 2, but got rank${s.shape.length}.`);
|
|
@@ -15453,16 +15456,16 @@ const $0 = {
|
|
|
15453
15456
|
* =============================================================================
|
|
15454
15457
|
*/
|
|
15455
15458
|
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 } =
|
|
15459
|
+
const { inputs: t, backend: e, attrs: n } = o, { equation: s } = n, a = t, { allDims: r, summedDims: i, idDims: c } = Zr(s, a.length);
|
|
15460
|
+
Jr(r.length, c, a);
|
|
15461
|
+
const { path: l, steps: u } = ei(i, c), p = u.length;
|
|
15459
15462
|
let d = null, h = r.length;
|
|
15460
15463
|
const f = [];
|
|
15461
15464
|
for (let m = 0; m < p; ++m) {
|
|
15462
15465
|
for (const x of u[m]) {
|
|
15463
|
-
const { permutationIndices: g, expandDims: C } =
|
|
15466
|
+
const { permutationIndices: g, expandDims: C } = ti(h, c[x]);
|
|
15464
15467
|
let I;
|
|
15465
|
-
|
|
15468
|
+
si(g) ? I = a[x] : (I = ve({ inputs: { x: a[x] }, backend: e, attrs: { perm: g } }), f.push(I));
|
|
15466
15469
|
const b = I.shape.slice();
|
|
15467
15470
|
for (let y = 0; y < C.length; ++y)
|
|
15468
15471
|
b.splice(C[y], 0, 1);
|
|
@@ -15565,7 +15568,7 @@ const P0 = `
|
|
|
15565
15568
|
opSnippet: O0,
|
|
15566
15569
|
packedOpSnippet: P0,
|
|
15567
15570
|
dtype: "bool",
|
|
15568
|
-
cpuKernelImpl:
|
|
15571
|
+
cpuKernelImpl: Sp
|
|
15569
15572
|
}), _0 = {
|
|
15570
15573
|
kernelName: ol,
|
|
15571
15574
|
backendName: "webgl",
|
|
@@ -15591,12 +15594,12 @@ const L0 = `
|
|
|
15591
15594
|
// Error function is calculated approximately with elementary function.
|
|
15592
15595
|
// See "Handbook of Mathematical Functions with Formulas,
|
|
15593
15596
|
// 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 = ${
|
|
15597
|
+
float p = ${ci};
|
|
15598
|
+
float a1 = ${ii};
|
|
15599
|
+
float a2 = ${ri};
|
|
15600
|
+
float a3 = ${ai};
|
|
15601
|
+
float a4 = ${oi};
|
|
15602
|
+
float a5 = ${ni};
|
|
15600
15603
|
|
|
15601
15604
|
float sign = sign(x);
|
|
15602
15605
|
x = abs(x);
|
|
@@ -15637,7 +15640,7 @@ const M0 = vt + `
|
|
|
15637
15640
|
`, hc = ae({
|
|
15638
15641
|
opSnippet: M0,
|
|
15639
15642
|
packedOpSnippet: B0,
|
|
15640
|
-
cpuKernelImpl:
|
|
15643
|
+
cpuKernelImpl: Rp,
|
|
15641
15644
|
dtype: "float32"
|
|
15642
15645
|
}), G0 = {
|
|
15643
15646
|
kernelName: al,
|
|
@@ -15686,7 +15689,7 @@ const z0 = {
|
|
|
15686
15689
|
* limitations under the License.
|
|
15687
15690
|
* =============================================================================
|
|
15688
15691
|
*/
|
|
15689
|
-
const $o = "return exp(x) - 1.0;", U0 = ae({ opSnippet: $o, packedOpSnippet: $o, cpuKernelImpl:
|
|
15692
|
+
const $o = "return exp(x) - 1.0;", U0 = ae({ opSnippet: $o, packedOpSnippet: $o, cpuKernelImpl: Tp }), H0 = {
|
|
15690
15693
|
kernelName: Eo,
|
|
15691
15694
|
backendName: "webgl",
|
|
15692
15695
|
kernelFunc: U0
|
|
@@ -15949,7 +15952,7 @@ const Q0 = {
|
|
|
15949
15952
|
* limitations under the License.
|
|
15950
15953
|
* =============================================================================
|
|
15951
15954
|
*/
|
|
15952
|
-
const wo = "return floor(x);", Z0 = ae({ opSnippet: wo, packedOpSnippet: wo, cpuKernelImpl:
|
|
15955
|
+
const wo = "return floor(x);", Z0 = ae({ opSnippet: wo, packedOpSnippet: wo, cpuKernelImpl: Dp }), J0 = {
|
|
15953
15956
|
kernelName: rl,
|
|
15954
15957
|
backendName: "webgl",
|
|
15955
15958
|
kernelFunc: Z0
|
|
@@ -16316,13 +16319,13 @@ class p$ {
|
|
|
16316
16319
|
* =============================================================================
|
|
16317
16320
|
*/
|
|
16318
16321
|
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] =
|
|
16322
|
+
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
16323
|
inputs: { x: n },
|
|
16321
16324
|
backend: e,
|
|
16322
16325
|
attrs: { shape: [z(n.shape) / u, u] }
|
|
16323
16326
|
});
|
|
16324
16327
|
if (e.shouldExecuteOnCPU([n, s]) || n.dtype === "string") {
|
|
16325
|
-
const g = e.readSync(s.dataId), C = e.bufferSync(n), I =
|
|
16328
|
+
const g = e.readSync(s.dataId), C = e.bufferSync(n), I = Ep(g, C, n.dtype, l, r, u, p, n.shape, i);
|
|
16326
16329
|
return e.makeTensorInfo(c, n.dtype, I.values);
|
|
16327
16330
|
}
|
|
16328
16331
|
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 +16397,7 @@ function mc(o) {
|
|
|
16394
16397
|
Y(y <= I - 1 && y >= 0, () => `GatherV2: the index value ${y} is not in [0, ${I - 1}]`);
|
|
16395
16398
|
}
|
|
16396
16399
|
}
|
|
16397
|
-
const l =
|
|
16400
|
+
const l = di(s, a, c, i), u = z(a.shape), p = [], d = H({
|
|
16398
16401
|
inputs: { x: s },
|
|
16399
16402
|
backend: e,
|
|
16400
16403
|
attrs: {
|
|
@@ -16418,7 +16421,7 @@ function mc(o) {
|
|
|
16418
16421
|
l.sliceSize
|
|
16419
16422
|
];
|
|
16420
16423
|
if (e.shouldExecuteOnCPU([s, a]) || s.dtype === "string") {
|
|
16421
|
-
const C = e.bufferSync(h), I = e.bufferSync(d), b =
|
|
16424
|
+
const C = e.bufferSync(h), I = e.bufferSync(d), b = Fp(I, C, f);
|
|
16422
16425
|
return p.forEach((y) => e.disposeIntermediateTensorInfo(y)), e.makeTensorInfo(l.outputShape, b.dtype, b.values);
|
|
16423
16426
|
}
|
|
16424
16427
|
const m = new m$(d.shape, f), x = e.runWebGLProgram(m, [d, h], d.dtype);
|
|
@@ -16452,7 +16455,7 @@ const C$ = "return float(a > b);", b$ = `
|
|
|
16452
16455
|
`, I$ = ke({
|
|
16453
16456
|
opSnippet: C$,
|
|
16454
16457
|
packedOpSnippet: b$,
|
|
16455
|
-
cpuKernelImpl:
|
|
16458
|
+
cpuKernelImpl: Pp,
|
|
16456
16459
|
dtype: "bool"
|
|
16457
16460
|
}), y$ = {
|
|
16458
16461
|
kernelName: ll,
|
|
@@ -16481,7 +16484,7 @@ const $$ = "return float(a >= b);", k$ = `
|
|
|
16481
16484
|
opSnippet: $$,
|
|
16482
16485
|
packedOpSnippet: k$,
|
|
16483
16486
|
dtype: "bool",
|
|
16484
|
-
cpuKernelImpl:
|
|
16487
|
+
cpuKernelImpl: Op
|
|
16485
16488
|
}), N$ = {
|
|
16486
16489
|
kernelName: ul,
|
|
16487
16490
|
backendName: "webgl",
|
|
@@ -16596,7 +16599,7 @@ const L$ = "return float(a < b);", V$ = `
|
|
|
16596
16599
|
`, W$ = ke({
|
|
16597
16600
|
opSnippet: L$,
|
|
16598
16601
|
packedOpSnippet: V$,
|
|
16599
|
-
cpuKernelImpl:
|
|
16602
|
+
cpuKernelImpl: Ap,
|
|
16600
16603
|
dtype: "bool"
|
|
16601
16604
|
}), M$ = {
|
|
16602
16605
|
kernelName: dl,
|
|
@@ -16624,7 +16627,7 @@ const B$ = "return float(a <= b);", G$ = `
|
|
|
16624
16627
|
`, z$ = ke({
|
|
16625
16628
|
opSnippet: B$,
|
|
16626
16629
|
packedOpSnippet: G$,
|
|
16627
|
-
cpuKernelImpl:
|
|
16630
|
+
cpuKernelImpl: _p,
|
|
16628
16631
|
dtype: "bool"
|
|
16629
16632
|
}), U$ = {
|
|
16630
16633
|
kernelName: pl,
|
|
@@ -16648,7 +16651,7 @@ const B$ = "return float(a <= b);", G$ = `
|
|
|
16648
16651
|
* =============================================================================
|
|
16649
16652
|
*/
|
|
16650
16653
|
function H$(o) {
|
|
16651
|
-
const { backend: t, attrs: e } = o, { start: n, stop: s, num: a } = e, r =
|
|
16654
|
+
const { backend: t, attrs: e } = o, { start: n, stop: s, num: a } = e, r = Lp(n, s, a);
|
|
16652
16655
|
return t.makeTensorInfo([r.length], "float32", r);
|
|
16653
16656
|
}
|
|
16654
16657
|
const X$ = {
|
|
@@ -16682,7 +16685,7 @@ const K$ = vt + `
|
|
|
16682
16685
|
result.b = isNaN.b ? x.b : (x.b < 0.0 ? 0./0. : result.b);
|
|
16683
16686
|
result.a = isNaN.a ? x.a : (x.a < 0.0 ? 0./0. : result.a);
|
|
16684
16687
|
return result;
|
|
16685
|
-
`, j$ = ae({ opSnippet: K$, packedOpSnippet: q$, cpuKernelImpl:
|
|
16688
|
+
`, j$ = ae({ opSnippet: K$, packedOpSnippet: q$, cpuKernelImpl: Vp }), Y$ = {
|
|
16686
16689
|
kernelName: hl,
|
|
16687
16690
|
backendName: "webgl",
|
|
16688
16691
|
kernelFunc: j$
|
|
@@ -17071,7 +17074,7 @@ const Ck = Wn + `
|
|
|
17071
17074
|
`, Ik = ke({
|
|
17072
17075
|
opSnippet: Ck,
|
|
17073
17076
|
packedOpSnippet: bk,
|
|
17074
|
-
cpuKernelImpl:
|
|
17077
|
+
cpuKernelImpl: Wp
|
|
17075
17078
|
}), yk = {
|
|
17076
17079
|
kernelName: fl,
|
|
17077
17080
|
backendName: "webgl",
|
|
@@ -17431,7 +17434,7 @@ const Ak = {
|
|
|
17431
17434
|
const b = r.texData.get(f.dataId).values, y = new Array(i);
|
|
17432
17435
|
for (let w = 0; w < y.length; w++)
|
|
17433
17436
|
y[w] = n.shape[u[w]];
|
|
17434
|
-
const $ =
|
|
17437
|
+
const $ = Ni(b, n.shape, n.dtype, u, y);
|
|
17435
17438
|
f = r.makeTensorInfo(y, n.dtype);
|
|
17436
17439
|
const k = r.texData.get(f.dataId);
|
|
17437
17440
|
k.values = $;
|
|
@@ -17513,7 +17516,7 @@ const Vk = Wn + `
|
|
|
17513
17516
|
`, Mk = ke({
|
|
17514
17517
|
opSnippet: Vk,
|
|
17515
17518
|
packedOpSnippet: Wk,
|
|
17516
|
-
cpuKernelImpl:
|
|
17519
|
+
cpuKernelImpl: Mp
|
|
17517
17520
|
}), Bk = {
|
|
17518
17521
|
kernelName: ml,
|
|
17519
17522
|
backendName: "webgl",
|
|
@@ -17783,7 +17786,7 @@ const No = "return a - b;", gc = ke({
|
|
|
17783
17786
|
opSnippet: No,
|
|
17784
17787
|
packedOpSnippet: No,
|
|
17785
17788
|
supportsComplex: !0,
|
|
17786
|
-
cpuKernelImpl:
|
|
17789
|
+
cpuKernelImpl: Bp
|
|
17787
17790
|
}), Qk = {
|
|
17788
17791
|
kernelName: gl,
|
|
17789
17792
|
backendName: "webgl",
|
|
@@ -17875,7 +17878,7 @@ const tw = Ue + `
|
|
|
17875
17878
|
function nw(o) {
|
|
17876
17879
|
const { inputs: t, backend: e } = o, { x: n } = t;
|
|
17877
17880
|
if (e.shouldExecuteOnCPU([n])) {
|
|
17878
|
-
const a = e.texData.get(n.dataId), [r, i] =
|
|
17881
|
+
const a = e.texData.get(n.dataId), [r, i] = Gp(a.values, n.shape, n.dtype);
|
|
17879
17882
|
return e.makeTensorInfo(i, n.dtype, r);
|
|
17880
17883
|
}
|
|
17881
17884
|
let s;
|
|
@@ -17902,7 +17905,7 @@ const ow = {
|
|
|
17902
17905
|
* limitations under the License.
|
|
17903
17906
|
* =============================================================================
|
|
17904
17907
|
*/
|
|
17905
|
-
const aw =
|
|
17908
|
+
const aw = mi;
|
|
17906
17909
|
function rw(o) {
|
|
17907
17910
|
Vt("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");
|
|
17908
17911
|
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 +17932,7 @@ const iw = {
|
|
|
17929
17932
|
* limitations under the License.
|
|
17930
17933
|
* =============================================================================
|
|
17931
17934
|
*/
|
|
17932
|
-
const cw =
|
|
17935
|
+
const cw = gi;
|
|
17933
17936
|
function lw(o) {
|
|
17934
17937
|
Vt("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");
|
|
17935
17938
|
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 +17962,7 @@ const uw = {
|
|
|
17959
17962
|
* limitations under the License.
|
|
17960
17963
|
* =============================================================================
|
|
17961
17964
|
*/
|
|
17962
|
-
const dw =
|
|
17965
|
+
const dw = xi;
|
|
17963
17966
|
function pw(o) {
|
|
17964
17967
|
Vt("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");
|
|
17965
17968
|
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 +18352,7 @@ function Rw(o) {
|
|
|
18349
18352
|
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
18353
|
let h;
|
|
18351
18354
|
if (e.shouldExecuteOnCPU([d])) {
|
|
18352
|
-
const f = e.texData.get(d.dataId).values, { outVals: m, outShape: x, outDtype: g } =
|
|
18355
|
+
const f = e.texData.get(d.dataId).values, { outVals: m, outShape: x, outDtype: g } = zp(d.shape, d.dtype, f, u);
|
|
18353
18356
|
h = e.makeTensorInfo(x, g, m);
|
|
18354
18357
|
} else {
|
|
18355
18358
|
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 +18387,7 @@ const Tw = {
|
|
|
18384
18387
|
* =============================================================================
|
|
18385
18388
|
*/
|
|
18386
18389
|
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] =
|
|
18390
|
+
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
18391
|
return m.concat([x]);
|
|
18389
18392
|
}
|
|
18390
18393
|
const Ew = {
|
|
@@ -18409,7 +18412,7 @@ const Ew = {
|
|
|
18409
18412
|
* =============================================================================
|
|
18410
18413
|
*/
|
|
18411
18414
|
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] =
|
|
18415
|
+
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
18416
|
return [p, d];
|
|
18414
18417
|
}
|
|
18415
18418
|
const Pw = {
|
|
@@ -18434,7 +18437,7 @@ const Pw = {
|
|
|
18434
18437
|
* =============================================================================
|
|
18435
18438
|
*/
|
|
18436
18439
|
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] =
|
|
18440
|
+
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
18441
|
return e.makeTensorInfo(f, a.dtype, m);
|
|
18439
18442
|
}
|
|
18440
18443
|
const Aw = {
|
|
@@ -18459,7 +18462,7 @@ const Aw = {
|
|
|
18459
18462
|
* =============================================================================
|
|
18460
18463
|
*/
|
|
18461
18464
|
const Ic = (o) => {
|
|
18462
|
-
const { backend: t, attrs: e } = o, { start: n, stop: s, step: a, dtype: r } = e, i =
|
|
18465
|
+
const { backend: t, attrs: e } = o, { start: n, stop: s, step: a, dtype: r } = e, i = Kp(n, s, a, r);
|
|
18463
18466
|
return t.makeTensorInfo([i.length], r, i);
|
|
18464
18467
|
}, _w = {
|
|
18465
18468
|
kernelName: er,
|
|
@@ -19369,7 +19372,7 @@ const hN = {
|
|
|
19369
19372
|
kernelName: rr,
|
|
19370
19373
|
backendName: "webgl",
|
|
19371
19374
|
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] =
|
|
19375
|
+
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
19376
|
return i.runWebGLProgram(c, [n], n.dtype, p);
|
|
19374
19377
|
}
|
|
19375
19378
|
};
|
|
@@ -19425,7 +19428,7 @@ const fN = `
|
|
|
19425
19428
|
* limitations under the License.
|
|
19426
19429
|
* =============================================================================
|
|
19427
19430
|
*/
|
|
19428
|
-
const xN = "return inversesqrt(x);", CN = ae({ opSnippet: xN, cpuKernelImpl:
|
|
19431
|
+
const xN = "return inversesqrt(x);", CN = ae({ opSnippet: xN, cpuKernelImpl: qp }), bN = {
|
|
19429
19432
|
kernelName: Cl,
|
|
19430
19433
|
backendName: "webgl",
|
|
19431
19434
|
kernelFunc: CN
|
|
@@ -19743,8 +19746,8 @@ const RN = {
|
|
|
19743
19746
|
const TN = `
|
|
19744
19747
|
// Stable and Attracting Fixed Point (0, 1) for Normalized Weights.
|
|
19745
19748
|
// see: https://arxiv.org/abs/1706.02515
|
|
19746
|
-
float scaleAlpha = ${
|
|
19747
|
-
float scale = ${
|
|
19749
|
+
float scaleAlpha = ${Gr};
|
|
19750
|
+
float scale = ${Br};
|
|
19748
19751
|
return (x >= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0);
|
|
19749
19752
|
`, DN = ae({ opSnippet: TN }), EN = {
|
|
19750
19753
|
kernelName: Sn,
|
|
@@ -19782,7 +19785,7 @@ const FN = vt + `
|
|
|
19782
19785
|
`, ON = ae({
|
|
19783
19786
|
opSnippet: FN,
|
|
19784
19787
|
packedOpSnippet: PN,
|
|
19785
|
-
cpuKernelImpl:
|
|
19788
|
+
cpuKernelImpl: jp
|
|
19786
19789
|
}), AN = {
|
|
19787
19790
|
kernelName: bl,
|
|
19788
19791
|
backendName: "webgl",
|
|
@@ -19973,7 +19976,7 @@ function QN(o) {
|
|
|
19973
19976
|
if (r.shape.length !== 0)
|
|
19974
19977
|
throw new Error(`Default value must be a scalar, saw:
|
|
19975
19978
|
${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] =
|
|
19979
|
+
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
19980
|
return [
|
|
19978
19981
|
e.makeTensorInfo(d, n.dtype, p),
|
|
19979
19982
|
e.makeTensorInfo([d[0]], s.dtype, h),
|
|
@@ -20010,7 +20013,7 @@ function JN(o) {
|
|
|
20010
20013
|
throw new Error(`Input shape should be a vector but received shape ${s.shape}`);
|
|
20011
20014
|
if (a.shape.length !== 1)
|
|
20012
20015
|
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] =
|
|
20016
|
+
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
20017
|
return [
|
|
20015
20018
|
e.makeTensorInfo(u, n.dtype, l),
|
|
20016
20019
|
e.makeTensorInfo([p.length], a.dtype, new Int32Array(p))
|
|
@@ -20047,7 +20050,7 @@ function tv(o) {
|
|
|
20047
20050
|
if (a.shape.length !== 1)
|
|
20048
20051
|
throw new Error(`Segment ids should be a vector but received shape
|
|
20049
20052
|
${a.shape}`);
|
|
20050
|
-
const r = e.readSync(n.dataId), i = e.readSync(s.dataId), c = e.readSync(a.dataId), [l, u] =
|
|
20053
|
+
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
20054
|
return e.makeTensorInfo(u, n.dtype, l);
|
|
20052
20055
|
}
|
|
20053
20056
|
const sv = {
|
|
@@ -20081,7 +20084,7 @@ function nv(o) {
|
|
|
20081
20084
|
if (a.shape.length !== 1)
|
|
20082
20085
|
throw new Error(`Segment ids should be a vector but received shape
|
|
20083
20086
|
${a.shape}`);
|
|
20084
|
-
const r = e.readSync(n.dataId), i = e.readSync(s.dataId), c = e.readSync(a.dataId), [l, u] =
|
|
20087
|
+
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
20088
|
return e.makeTensorInfo(u, n.dtype, l);
|
|
20086
20089
|
}
|
|
20087
20090
|
const ov = {
|
|
@@ -20108,7 +20111,7 @@ const ov = {
|
|
|
20108
20111
|
function av(o) {
|
|
20109
20112
|
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
20113
|
if (a.dtype === "string") {
|
|
20111
|
-
const g = e.bufferSync(s), C = e.bufferSync(a), I = Wt(e.readSync(r.dataId)[0]), b =
|
|
20114
|
+
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
20115
|
return e.makeTensorInfo(i, b.dtype, b.values);
|
|
20113
20116
|
}
|
|
20114
20117
|
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 +20139,7 @@ const rv = {
|
|
|
20136
20139
|
* =============================================================================
|
|
20137
20140
|
*/
|
|
20138
20141
|
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 =
|
|
20142
|
+
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
20143
|
return c.map((d) => {
|
|
20141
20144
|
const h = [...p];
|
|
20142
20145
|
h[i] = d;
|
|
@@ -20165,7 +20168,7 @@ const cv = {
|
|
|
20165
20168
|
* limitations under the License.
|
|
20166
20169
|
* =============================================================================
|
|
20167
20170
|
*/
|
|
20168
|
-
const vo = "return sqrt(x);", lv = ae({ opSnippet: vo, packedOpSnippet: vo, cpuKernelImpl:
|
|
20171
|
+
const vo = "return sqrt(x);", lv = ae({ opSnippet: vo, packedOpSnippet: vo, cpuKernelImpl: Jp }), uv = {
|
|
20169
20172
|
kernelName: Il,
|
|
20170
20173
|
backendName: "webgl",
|
|
20171
20174
|
kernelFunc: lv
|
|
@@ -20232,7 +20235,7 @@ function gv(o) {
|
|
|
20232
20235
|
const { inputs: t, backend: e, attrs: n } = o, { x: s } = t;
|
|
20233
20236
|
if (s.dtype !== "string")
|
|
20234
20237
|
throw new Error("Input must be of datatype string");
|
|
20235
|
-
const a = e.readSync(s.dataId), r =
|
|
20238
|
+
const a = e.readSync(s.dataId), r = Md(a), i = eh(r, "string", n);
|
|
20236
20239
|
return e.makeTensorInfo(s.shape, "string", i);
|
|
20237
20240
|
}
|
|
20238
20241
|
const xv = {
|
|
@@ -20322,16 +20325,16 @@ class Iv {
|
|
|
20322
20325
|
* =============================================================================
|
|
20323
20326
|
*/
|
|
20324
20327
|
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 } =
|
|
20328
|
+
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
20329
|
let y;
|
|
20327
20330
|
if (m)
|
|
20328
20331
|
y = H({ inputs: { x: s }, backend: e, attrs: { shape: f } });
|
|
20329
20332
|
else if (x || g) {
|
|
20330
20333
|
Y(s.shape.length >= 1, () => `Input must have rank at least 1, got: ${s.shape.length}`);
|
|
20331
|
-
const k =
|
|
20334
|
+
const k = Ur(C, I, b), w = St({ inputs: { x: s }, backend: e, attrs: { begin: C, size: k } });
|
|
20332
20335
|
y = H({ inputs: { x: w }, backend: e, attrs: { shape: f } }), e.disposeIntermediateTensorInfo(w);
|
|
20333
20336
|
} else if (e.shouldExecuteOnCPU([s])) {
|
|
20334
|
-
const w = e.readSync(s.dataId), v = xe(s.shape, s.dtype, w), N =
|
|
20337
|
+
const w = e.readSync(s.dataId), v = xe(s.shape, s.dtype, w), N = th(h, v, b, C);
|
|
20335
20338
|
y = e.makeTensorInfo(f, s.dtype, N.values);
|
|
20336
20339
|
} else {
|
|
20337
20340
|
const w = new Iv(C, b, h);
|
|
@@ -20362,7 +20365,7 @@ const $v = {
|
|
|
20362
20365
|
* =============================================================================
|
|
20363
20366
|
*/
|
|
20364
20367
|
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] =
|
|
20368
|
+
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
20369
|
return [
|
|
20367
20370
|
e.makeTensorInfo([f.length], "string", f),
|
|
20368
20371
|
e.makeTensorInfo(p.shape, "int32", m)
|
|
@@ -20397,7 +20400,7 @@ function Nv(o) {
|
|
|
20397
20400
|
throw new Error(`Input must be a vector, got shape: ${a.shape}`);
|
|
20398
20401
|
if (r.shape.length !== 0)
|
|
20399
20402
|
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] =
|
|
20403
|
+
const i = e.readSync(a.dataId), c = e.readSync(r.dataId)[0], [l, u, p] = nh(i, c, s), d = u.length;
|
|
20401
20404
|
return [
|
|
20402
20405
|
e.makeTensorInfo([d, 2], "int32", l),
|
|
20403
20406
|
e.makeTensorInfo([d], "string", u),
|
|
@@ -20431,7 +20434,7 @@ function Sv(o) {
|
|
|
20431
20434
|
throw new Error("Input must be of datatype string");
|
|
20432
20435
|
if (s <= 0)
|
|
20433
20436
|
throw new Error("Number of buckets must be at least 1");
|
|
20434
|
-
const r = e.readSync(a.dataId), i =
|
|
20437
|
+
const r = e.readSync(a.dataId), i = oh(r, s);
|
|
20435
20438
|
return e.makeTensorInfo(a.shape, "int32", i);
|
|
20436
20439
|
}
|
|
20437
20440
|
const Rv = {
|
|
@@ -20574,7 +20577,7 @@ function Vv(o) {
|
|
|
20574
20577
|
function yc(o) {
|
|
20575
20578
|
const { inputs: t, backend: e, attrs: n } = o, { x: s } = t, { reps: a } = n;
|
|
20576
20579
|
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 =
|
|
20580
|
+
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
20581
|
return e.makeTensorInfo(p.shape, p.dtype, p.values);
|
|
20579
20582
|
}
|
|
20580
20583
|
const r = new Lv(s.shape, a);
|
|
@@ -20714,7 +20717,7 @@ function Ro(o) {
|
|
|
20714
20717
|
function Gv(o) {
|
|
20715
20718
|
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
20719
|
if (e.shouldExecuteOnCPU([s]) || u < i || a > c) {
|
|
20717
|
-
const N = e.readSync(s.dataId), [P, O] =
|
|
20720
|
+
const N = e.readSync(s.dataId), [P, O] = rh(N, l, s.dtype, a, r);
|
|
20718
20721
|
return [
|
|
20719
20722
|
e.makeTensorInfo(P.shape, P.dtype, P.values),
|
|
20720
20723
|
e.makeTensorInfo(O.shape, O.dtype, O.values)
|
|
@@ -20966,7 +20969,7 @@ const Xv = {
|
|
|
20966
20969
|
function Kv(o) {
|
|
20967
20970
|
const { inputs: t, attrs: e, backend: n } = o, { axis: s } = e, { x: a } = t;
|
|
20968
20971
|
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 } =
|
|
20972
|
+
const r = n.readSync(a.dataId), { outputValues: i, outputShape: c, indices: l } = ih(r, s, a.shape, a.dtype);
|
|
20970
20973
|
return [
|
|
20971
20974
|
n.makeTensorInfo(c, a.dtype, i),
|
|
20972
20975
|
n.makeTensorInfo([l.length], "int32", l)
|
|
@@ -21172,10 +21175,10 @@ function Zv(o) {
|
|
|
21172
21175
|
const u = ye([l], i);
|
|
21173
21176
|
let p = s;
|
|
21174
21177
|
u != null && (p = ve({ inputs: { x: s }, backend: e, attrs: { perm: u } }), c.push(p), l = $e(1, i)[0]);
|
|
21175
|
-
const d =
|
|
21178
|
+
const d = Bd(p.shape, l, r), h = z([p.shape[l]]), f = H({ inputs: { x: p }, backend: e, attrs: { shape: [-1, h] } });
|
|
21176
21179
|
c.push(f);
|
|
21177
21180
|
const m = Tr(s.dtype), x = (b, y, $, k, w) => {
|
|
21178
|
-
const v = b.shape[0], N = b.shape[1], P =
|
|
21181
|
+
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
21182
|
if (c.push(F), F.shape[1] === w)
|
|
21180
21183
|
return F;
|
|
21181
21184
|
const T = Ic({
|